use of org.broadinstitute.consent.http.models.ElectionReviewVote in project consent by DataBiosphere.
the class ReviewResultsService method describeElectionReviewByElectionId.
public ElectionReview describeElectionReviewByElectionId(Integer electionId) {
ElectionReview review = null;
Election election = electionDAO.findElectionWithFinalVoteById(electionId);
if (election != null) {
review = new ElectionReview();
review.setElection(election);
Consent consent = consentDAO.findConsentById(review.getElection().getReferenceId());
List<ElectionReviewVote> rVotes = voteDAO.findAllElectionReviewVotesByElectionId(electionId);
review.setReviewVote(rVotes);
review.setConsent(consent);
}
return review;
}
use of org.broadinstitute.consent.http.models.ElectionReviewVote in project consent by DataBiosphere.
the class ReviewResultsService method getElectionReview.
private ElectionReview getElectionReview(String referenceId, Election election) {
ElectionReview review = null;
if (election != null) {
review = new ElectionReview();
List<ElectionReviewVote> rVotes = voteDAO.findElectionReviewVotesByElectionId(election.getElectionId());
Consent consent = consentDAO.findConsentById(referenceId);
review.setConsent(consent);
review.setElection(election);
review.setReviewVote(rVotes);
}
return review;
}
use of org.broadinstitute.consent.http.models.ElectionReviewVote in project consent by DataBiosphere.
the class VoteDAOTest method testFindElectionReviewVotesByElectionIdAndType.
@Test
public void testFindElectionReviewVotesByElectionIdAndType() {
User user = createUserWithRole(UserRoles.CHAIRPERSON.getRoleId());
Consent consent = createConsent(null);
DataSet dataset = createDataset();
Election election = createAccessElection(consent.getConsentId(), dataset.getDataSetId());
Vote vote = createDacVote(user.getDacUserId(), election.getElectionId());
List<ElectionReviewVote> votes = voteDAO.findElectionReviewVotesByElectionId(election.getElectionId(), vote.getType());
Assert.assertFalse(votes.isEmpty());
Assert.assertEquals(user.getEmail(), votes.get(0).getEmail());
List<ElectionReviewVote> votes2 = voteDAO.findElectionReviewVotesByElectionId(election.getElectionId(), vote.getType().toUpperCase());
Assert.assertFalse(votes2.isEmpty());
Assert.assertEquals(user.getEmail(), votes2.get(0).getEmail());
List<ElectionReviewVote> votes3 = voteDAO.findElectionReviewVotesByElectionId(election.getElectionId(), vote.getType().toLowerCase());
Assert.assertFalse(votes3.isEmpty());
Assert.assertEquals(user.getEmail(), votes3.get(0).getEmail());
}
use of org.broadinstitute.consent.http.models.ElectionReviewVote in project consent by DataBiosphere.
the class VoteDAOTest method testFindElectionReviewVotesByElectionId.
@Test
public void testFindElectionReviewVotesByElectionId() {
User user = createUserWithRole(UserRoles.CHAIRPERSON.getRoleId());
Consent consent = createConsent(null);
DataSet dataset = createDataset();
Election election = createAccessElection(consent.getConsentId(), dataset.getDataSetId());
createDacVote(user.getDacUserId(), election.getElectionId());
List<ElectionReviewVote> votes = voteDAO.findElectionReviewVotesByElectionId(election.getElectionId());
Assert.assertFalse(votes.isEmpty());
Assert.assertEquals(user.getEmail(), votes.get(0).getEmail());
}
Aggregations