Esempio n. 1
0
def get_round(user_dao, round_id):
    """
    Summary: Get juror-level details for a round, identified by round ID.
    """
    juror_dao = JurorDAO(user_dao)
    rnd = juror_dao.get_round(round_id)
    ballot = juror_dao.get_ballot(round_id)
    rnd_stats = juror_dao.get_round_task_counts(round_id)
    data = make_juror_round_details(rnd, rnd_stats,
                                    ballot)  # TODO: add to Round model
    return {'data': data}
Esempio n. 2
0
def get_campaign(user_dao, campaign_id):
    """
    Summary: Get juror-level list of rounds, identified by campaign ID.
    """
    juror_dao = JurorDAO(user_dao)
    campaign = juror_dao.get_campaign(campaign_id)
    data = campaign.to_details_dict()
    rounds = []
    for rnd in campaign.rounds:
        rnd_stats = user_dao.get_round_task_counts(rnd.id)
        ballot = juror_dao.get_ballot(rnd.id)
        rounds.append(make_juror_round_details(rnd, rnd_stats, ballot))
    data['rounds'] = rounds
    return {'data': data}