From 0b2512ffc12b212dbbddfe9c0a65a0a8b59df7bb Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 21 Jun 2018 12:51:53 +0200 Subject: [PATCH] fix #212 by filtering in unstarted fcps. --- src/nag.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/nag.rs b/src/nag.rs index 73de0e7a..1bb94504 100644 --- a/src/nag.rs +++ b/src/nag.rs @@ -75,28 +75,23 @@ pub fn individual_nags(username: &str) -> DashResult<(GitHubUser, Vec(conn)?; let review_requests = fcp_review_request::table + .inner_join(fcp_proposal::table) + .filter(fcp_proposal::fcp_start.is_null()) .filter(fcp_review_request::fk_reviewer.eq(user.id)) .filter(fcp_review_request::reviewed.eq(false)) - .load::(conn)?; + .load::<(FcpReviewRequest, FcpProposal)>(conn)?; let mut fcps = Vec::new(); - - for rr in review_requests { - let proposal = fcp_proposal::table - .filter(fcp_proposal::id.eq(rr.fk_proposal)) - .first::(conn)?; - + for (rr, proposal) in review_requests { let issue = issue::table .filter(issue::id.eq(proposal.fk_issue)) .first::(conn)?; - let fcp = IndividualFcp { + fcps.push(IndividualFcp { issue: issue, proposal: proposal, review_request: rr, - }; - - fcps.push(fcp); + }); } Ok((user, fcps))