Search in sources :

Example 1 with ElectionReviewVote

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;
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) Consent(org.broadinstitute.consent.http.models.Consent) Election(org.broadinstitute.consent.http.models.Election)

Example 2 with ElectionReviewVote

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;
}
Also used : ElectionReview(org.broadinstitute.consent.http.models.ElectionReview) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) Consent(org.broadinstitute.consent.http.models.Consent)

Example 3 with ElectionReviewVote

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());
}
Also used : Vote(org.broadinstitute.consent.http.models.Vote) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) User(org.broadinstitute.consent.http.models.User) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) Consent(org.broadinstitute.consent.http.models.Consent) DataSet(org.broadinstitute.consent.http.models.DataSet) Election(org.broadinstitute.consent.http.models.Election) Test(org.junit.Test)

Example 4 with ElectionReviewVote

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());
}
Also used : User(org.broadinstitute.consent.http.models.User) ElectionReviewVote(org.broadinstitute.consent.http.models.ElectionReviewVote) Consent(org.broadinstitute.consent.http.models.Consent) DataSet(org.broadinstitute.consent.http.models.DataSet) Election(org.broadinstitute.consent.http.models.Election) Test(org.junit.Test)

Aggregations

Consent (org.broadinstitute.consent.http.models.Consent)4 ElectionReviewVote (org.broadinstitute.consent.http.models.ElectionReviewVote)4 Election (org.broadinstitute.consent.http.models.Election)3 DataSet (org.broadinstitute.consent.http.models.DataSet)2 ElectionReview (org.broadinstitute.consent.http.models.ElectionReview)2 User (org.broadinstitute.consent.http.models.User)2 Test (org.junit.Test)2 Vote (org.broadinstitute.consent.http.models.Vote)1