Exemple #1
0
 def _after_save(self, original_data, instance):
     mark_if_complete(instance.task_id, instance.project_id)
     task = task_repo.get_task(instance.task_id)
     gold_answers = get_gold_answers(task)
     update_gold_stats(instance.user_id, instance.task_id, original_data,
                       gold_answers)
     update_quiz(instance.project_id, original_data['info'], gold_answers)
Exemple #2
0
def update_gold_stats(user_id, task_id, data, gold_answers=None):
    task = task_repo.get_task(task_id)
    if not task.calibration:
        return

    if gold_answers is None:
        gold_answers = get_gold_answers(task)
    answer_fields = get_project_data(task.project_id)['info'].get(
        'answer_fields', {})
    answer = data['info']
    _update_gold_stats(task.project_id, user_id, answer_fields, gold_answers,
                       answer)
Exemple #3
0
 def _customize_response_dict(self, response_dict):
     task = task_repo.get_task(response_dict['task_id'])
     response_dict['gold_answers'] = get_gold_answers(task)