Created
June 27, 2016 19:46
-
-
Save cnk/f50c8bfd650019168490bf8151c4048f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last_answer = StudentNumericAnswer.objects.filter(numeric_question=question_id, | |
student=request.user.id).order_by('updated_at').last() | |
if request.method == 'GET': | |
if not last_answer: | |
return Response(status=status.HTTP_404_NOT_FOUND) | |
data = StudentNumericAnswerSerializer(last_answer, context={'request': request}).data | |
# CNK cheat and add the correct answer data here for now | |
if last_answer.is_answer_correct or last_answer.gave_up: | |
data['correct_answer'] = {'correct_answer': question.correct_answer, | |
'tolerance': question.tolerance} | |
return Response(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment