Repository: learningequality/kolibri

Issue:
After submitting the exam the learner is still allowed to start the exam.
## Summary
After submitting the exam the learner is still allowed to start the exam. Where as it should show the **Completed** and the learner should not be allowed to retake.


## System information

 - Version: Kolibri 0.4.0aplha2
 - Operating system: Ubuntu 14.04 LTS
 - Browser: Chrome browser and Firefox


## How to reproduce

1. Login as a learner
2. Start giving an exam.
3. Enter all the answers.
4. Click on submit exam.
5. Ideally the learner should be given completed exam status.

## Screenshots
Before Exam
![before](https://cloud.githubusercontent.com/assets/12776071/25124398/3ab80a34-2449-11e7-993b-ff22a4f9b55c.png)

![mid](https://cloud.githubusercontent.com/assets/12776071/25124508/8b1efee2-2449-11e7-8034-38192fbb99a7.png)

After Exam
![after](https://cloud.githubusercontent.com/assets/12776071/25124403/3c89f778-2449-11e7-9fed-ff93e8712af3.png)

coach exam report doesn't reflect actual status
I completed an exam, but it still shows it as 'in progress' with only one question answered:

![image](https://cloud.githubusercontent.com/assets/2367265/25415857/4a66dac2-29ef-11e7-9de7-eed964fb7557.png)




On reviewing the previous questions after entering the answers, the answers disappear for exam.
## Summary
On reviewing the previous questions after entering their answers, the answers disappears for those questions that a user is reviewing.

## System information
 - Version: Kolibri 0.4.0alpha5
 - Operating system: Ubuntu 14.04 LTS
 - Browser: Chrome browser and Firefox

## How to reproduce

1. Login as learner.
2. Click on Exams tab and select any exam.
3. Attempt all questions.
4. Go back and start reviewing each questions.

**Actual results:**
 The answers starts disappearing and the question highlighter on the left also disappears as you continue to review.

**Expected results:**
The previous recorded answers should be present and the question highlighter should be purple.

## Screenshots
Attempted all the questions:
![attempted all question answer_1](https://cloud.githubusercontent.com/assets/12776071/25427620/ca72f632-2a90-11e7-842b-443911f3b4e3.png)

Start reviewing the questions from the beginning:
(The answers starts disappearing with the question highlighter) 
![attempted all question answer_2](https://cloud.githubusercontent.com/assets/12776071/25427711/047c24f2-2a91-11e7-919c-c2fcee139ed0.png)





Discussion:
Interesting, this seems to be a different behaviour to that reported in #1242, what was the difference in work flow that led to this?
@rtibbles Great that you were able to reproduce this. I believe you are not able to reproduce #1242 and I will comment on that bug.
Should be fixed in latest alpha.
@rtibbles Not able to test this because of #1238
@rtibbles @aronasorman retested with channel ID you provided (78eed5c0b59b30c0a40c94c17c849af6) but the issue still exists.

![1](https://cloud.githubusercontent.com/assets/12776071/25380872/66fb7d7a-29cf-11e7-9089-a5a6b3eb79b7.png)
![2](https://cloud.githubusercontent.com/assets/12776071/25380873/66fcbb4a-29cf-11e7-841a-2c2648197e99.png)
![3](https://cloud.githubusercontent.com/assets/12776071/25380874/66fe44ce-29cf-11e7-9c31-eb3d6b1aff23.png)

I'm still reproducing this. Perhaps related to https://github.com/learningequality/kolibri/issues/1340 ?

I retested in latest alpha 0.4.0aplha5 and this issue is **not** yet fixed.

![exam submit](https://cloud.githubusercontent.com/assets/13453618/25428067/3c7b4c42-2a92-11e7-91e4-99e4b35415b0.png)
![exam start 2](https://cloud.githubusercontent.com/assets/13453618/25428069/3d0bc916-2a92-11e7-9464-a3c7c3528954.png)
![exam start 3](https://cloud.githubusercontent.com/assets/13453618/25428071/40002b08-2a92-11e7-8260-bbe5bc836d23.png)


Seems like an empty answer is somehow getting set back on the attemptlog - we should prevent that from happening.

Resolving patch:
diff --git a/kolibri/logger/serializers.py b/kolibri/logger/serializers.py
--- a/kolibri/logger/serializers.py
+++ b/kolibri/logger/serializers.py
@@ -31,7 +31,7 @@ def update(self, instance, validated_data):
         # This has changed, set the completion timestamp
         if validated_data.get('closed') and not instance.closed:
             instance.completion_timestamp = now()
-        return instance
+        return super(ExamLogSerializer, self).update(instance, validated_data)
 
 class MasteryLogSerializer(serializers.ModelSerializer):
 


Test patch: