Skip to content

Commit

Permalink
fix rust-lang#212 by filtering in unstarted fcps.
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jun 21, 2018
1 parent 35ea208 commit 0b2512f
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/nag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,23 @@ pub fn individual_nags(username: &str) -> DashResult<(GitHubUser, Vec<Individual
.first::<GitHubUser>(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::<FcpReviewRequest>(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::<FcpProposal>(conn)?;

for (rr, proposal) in review_requests {
let issue = issue::table
.filter(issue::id.eq(proposal.fk_issue))
.first::<Issue>(conn)?;

let fcp = IndividualFcp {
fcps.push(IndividualFcp {
issue: issue,
proposal: proposal,
review_request: rr,
};

fcps.push(fcp);
});
}

Ok((user, fcps))
Expand Down

0 comments on commit 0b2512f

Please sign in to comment.