1
1
import random
2
+ from datetime import datetime
2
3
3
4
from django .contrib .auth .decorators import login_required , permission_required
4
5
from django .core .exceptions import PermissionDenied
@@ -157,6 +158,8 @@ def dispatch(self, request, *args, **kwargs):
157
158
def get_form (self , form_class ):
158
159
if self .logged_in_user :
159
160
self .question = self .sitting .get_first_question ()
161
+ self .question .question_take_time = datetime .now ()
162
+ self .question .save ()
160
163
self .progress = self .sitting .progress ()
161
164
else :
162
165
self .question = self .anon_next_question ()
@@ -201,8 +204,9 @@ def form_valid_user(self, form):
201
204
guess = form .cleaned_data ['answers' ]
202
205
is_correct = self .question .check_if_correct (guess )
203
206
# HERE FIX
207
+ is_in_time = self .question .check_in_time ()
204
208
205
- if is_correct is True :
209
+ if is_correct and is_in_time :
206
210
self .sitting .add_to_score (1 )
207
211
progress .update_score (self .question , 1 , 1 )
208
212
else :
@@ -212,6 +216,7 @@ def form_valid_user(self, form):
212
216
if self .quiz .answers_at_end is not True :
213
217
self .previous = {'previous_answer' : guess ,
214
218
'previous_outcome' : is_correct ,
219
+ 'previous_in_time' : is_in_time ,
215
220
'previous_question' : self .question ,
216
221
'answers' : self .question .get_answers (),
217
222
'question_type' : {self .question
0 commit comments