Skip to content

Commit

Permalink
add api for getting answer_sheet answers
Browse files Browse the repository at this point in the history
  • Loading branch information
AmooHashem committed Jul 24, 2024
1 parent 00cbd2b commit e9a06cf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/response/views/answer_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ def answers(self, request, *args, **kwargs):
older_answers = PROBLEM_ANSWER_MAPPING[question.widget_type].objects.filter(
problem=question, submitted_by__in=teammates)
return Response(data=AnswerPolymorphicSerializer(older_answers, many=True).data, status=status.HTTP_200_OK)

@action(detail=False, methods=['get'])
def question_answers(self, request, *args, **kwargs):
question_id = request.GET.get('widget')
question = get_question(question_id=question_id)
# todo
return Response()

@action(detail=False, methods=['get'])
def answer_sheet_answers(self, request, *args, **kwargs):
answer_sheet_id = request.GET.get('answer_sheet')
answer_sheet = AnswerSheet.objects.get(id=answer_sheet_id)
answers = answer_sheet.answers
return Response(AnswerPolymorphicSerializer(answers, many=True).data)

0 comments on commit e9a06cf

Please sign in to comment.