summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/test_views.py4
-rw-r--r--yaksh/views.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 24750e3..a7ccac2 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -5496,8 +5496,8 @@ class TestQuestionPaper(TestCase):
self.answerpaper = AnswerPaper.objects.create(
user=self.user, question_paper=self.question_paper,
attempt_number=1,
- start_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone),
- end_time=datetime(2014, 10, 9, 10, 15, 15, 0, tzone),
+ start_time=timezone.now() - timezone.timedelta(minutes = 10),
+ end_time=timezone.now() - timezone.timedelta(minutes = 1),
user_ip="127.0.0.1", status="inprogress", passed=False,
percent=0, marks_obtained=0, course=self.course
)
diff --git a/yaksh/views.py b/yaksh/views.py
index 44c3940..d8502a3 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -743,7 +743,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None,
if request.method == 'POST':
# Add the answer submitted, regardless of it being correct or not.
- if paper.time_left() <= 0 or questionpaper.can_attempt_now(user, course_id)[0]:
+ if paper.time_left() <= 0 or not questionpaper.can_attempt_now(user, course_id)[0]:
reason = 'Your time is up!'
return complete(
request, reason, paper.attempt_number, paper.question_paper.id,