@@ -213,7 +213,7 @@ fn evaluate_polls() -> DashResult<()> {
213
213
throw!( why)
214
214
} ) ;
215
215
216
- for survey in pending {
216
+ for mut survey in pending {
217
217
let initiator = githubuser:: table. find ( survey. fk_initiator )
218
218
. first :: < GitHubUser > ( conn) ;
219
219
let initiator = ok_or_continue ! ( initiator, why =>
@@ -224,7 +224,7 @@ fn evaluate_polls() -> DashResult<()> {
224
224
let issue = ok_or_continue ! ( issue, why =>
225
225
error!( "Unable to retrieve issue for poll {}: {:?}" ,
226
226
survey. id, why) ) ;
227
-
227
+
228
228
// check to see if any checkboxes were modified before we end up replacing the comment
229
229
ok_or_continue ! ( update_poll_review_status( survey. id) , why =>
230
230
error!( "Unable to update review status for poll {}: {:?}" ,
@@ -235,6 +235,15 @@ fn evaluate_polls() -> DashResult<()> {
235
235
error!( "Unable to retrieve review requests for survey {}: {:?}" ,
236
236
survey. id, why) ) ;
237
237
238
+ // If everyone has answered the poll, close it:
239
+ if reviews. iter ( ) . all ( |( _, review) | review. reviewed ) {
240
+ survey. poll_closed = true ;
241
+ let update = diesel:: update ( poll. find ( survey. id ) )
242
+ . set ( & survey) . execute ( conn) ;
243
+ ok_or_continue ! ( update, why =>
244
+ error!( "Unable to close poll {}: {:?}" , survey. id, why) ) ;
245
+ }
246
+
238
247
// update existing status comment with reviews & concerns
239
248
let status_comment = RfcBotComment :: new ( & issue, CommentType :: QuestionAsked {
240
249
initiator : & initiator,
@@ -722,7 +731,7 @@ fn process_poll
722
731
} ;
723
732
let members = specific_subteam_members ( |l| teams. contains ( & * * l) ) ?;
724
733
725
- info ! ( "adding a new question to issue." ) ;
734
+ info ! ( "adding a new poll to issue." ) ;
726
735
727
736
// leave github comment stating that question is asked, ping reviewers
728
737
let gh_comment = post_insert_comment ( issue, CommentType :: QuestionAsked {
0 commit comments