File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -344,4 +344,7 @@ CREATE EXTENSION IF NOT EXISTS intarray;",
344344 "
345345CREATE UNIQUE INDEX IF NOT EXISTS review_prefs_user_id ON review_prefs(user_id);
346346 " ,
347+ "
348+ ALTER TABLE review_prefs ADD COLUMN max_assigned_prs INTEGER DEFAULT NULL;
349+ " ,
347350] ;
Original file line number Diff line number Diff line change @@ -131,17 +131,25 @@ pub struct ReviewPrefs {
131131 pub username : String ,
132132 pub user_id : i64 ,
133133 pub assigned_prs : Vec < i32 > ,
134+ pub max_assigned_prs : Option < i32 > ,
134135}
135136
136137impl ReviewPrefs {
137138 fn to_string ( & self ) -> String {
139+ let capacity = match self . max_assigned_prs {
140+ Some ( max) => format ! ( "{}" , max) ,
141+ None => String :: from ( "Not set (i.e. unlimited)" ) ,
142+ } ;
138143 let prs = self
139144 . assigned_prs
140145 . iter ( )
141146 . map ( |pr| format ! ( "#{}" , pr) )
142147 . collect :: < Vec < String > > ( )
143148 . join ( ", " ) ;
144- format ! ( "Username: {}\n Assigned PRs: {}" , self . username, prs)
149+ format ! (
150+ "Username: {}\n Assigned PRs: {}\n Review capacity: {}" ,
151+ self . username, prs, capacity
152+ )
145153 }
146154}
147155
@@ -152,6 +160,7 @@ impl From<tokio_postgres::row::Row> for ReviewPrefs {
152160 username : row. get ( "username" ) ,
153161 user_id : row. get ( "user_id" ) ,
154162 assigned_prs : row. get ( "assigned_prs" ) ,
163+ max_assigned_prs : row. get ( "max_assigned_prs" ) ,
155164 }
156165 }
157166}
You can’t perform that action at this time.
0 commit comments