def get_campaign_info(user_dao, campaign_id): """ Summary: Get juror-level info for a round, identified by campaign ID. """ juror_dao = JurorDAO(use_dao) campaign = juror_dao.get_campaign(campaign_id) ret = CampaignInfo(campaign) # TODO: add as a method on the Round model? return {'data': ret}
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) rounds.append(make_juror_round_details(rnd, rnd_stats)) data['rounds'] = rounds return {'data': data}