File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -335,4 +335,5 @@ CREATE table review_prefs (
335
335
CREATE EXTENSION intarray;
336
336
CREATE UNIQUE INDEX review_prefs_user_id ON review_prefs(user_id);
337
337
" ,
338
+ "ALTER TABLE review_prefs ADD COLUMN max_assigned_prs INTEGER DEFAULT NULL;" ,
338
339
] ;
Original file line number Diff line number Diff line change @@ -132,17 +132,26 @@ pub struct ReviewPrefs {
132
132
pub username : String ,
133
133
pub user_id : i64 ,
134
134
pub assigned_prs : Vec < i32 > ,
135
+ pub max_assigned_prs : Option < i32 > ,
135
136
}
136
137
137
138
impl ReviewPrefs {
138
139
fn to_string ( & self ) -> String {
140
+ let capacity = if self . max_assigned_prs . is_some ( ) {
141
+ format ! ( "{}" , self . max_assigned_prs. expect( "This can't fail" ) )
142
+ } else {
143
+ String :: from ( "Not set (i.e. unlimited)" )
144
+ } ;
139
145
let prs = self
140
146
. assigned_prs
141
147
. iter ( )
142
148
. map ( |pr| format ! ( "#{}" , pr) )
143
149
. collect :: < Vec < String > > ( )
144
150
. join ( ", " ) ;
145
- format ! ( "Username: {}\n Assigned PRs: {}" , self . username, prs)
151
+ format ! (
152
+ "Username: {}\n Assigned PRs: {}\n Review capacity: {}" ,
153
+ self . username, prs, capacity
154
+ )
146
155
}
147
156
}
148
157
@@ -153,6 +162,7 @@ impl From<tokio_postgres::row::Row> for ReviewPrefs {
153
162
username : row. get ( "username" ) ,
154
163
user_id : row. get ( "user_id" ) ,
155
164
assigned_prs : row. get ( "assigned_prs" ) ,
165
+ max_assigned_prs : row. get ( "max_assigned_prs" ) ,
156
166
}
157
167
}
158
168
}
You can’t perform that action at this time.
0 commit comments