summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2020-09-23 19:57:14 +0530
committeradityacp2020-09-23 19:57:14 +0530
commit8444e93ac160f64d03525940f738ff5aa52cd20a (patch)
treea67b0e0d5649af9e8b1bdf004907f3e9a0d1337b
parent7589f9838ac5080a5f2fb5f9c92522bc722ab80b (diff)
parentdb5ea3d7456d77c4e74538d5db120fbdfa9613e9 (diff)
downloadonline_test-8444e93ac160f64d03525940f738ff5aa52cd20a.tar.gz
online_test-8444e93ac160f64d03525940f738ff5aa52cd20a.tar.bz2
online_test-8444e93ac160f64d03525940f738ff5aa52cd20a.zip
Fix conflicts
-rw-r--r--yaksh/models.py9
-rw-r--r--yaksh/templates/yaksh/monitor.html20
-rw-r--r--yaksh/views.py14
3 files changed, 27 insertions, 16 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 8db054d..6a6fe12 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -2250,7 +2250,14 @@ class AnswerPaper(models.Model):
return questions
def set_extra_time(self, time=0):
- self.extra_time = time
+ now = timezone.now()
+ self.extra_time += time
+ if self.status == 'completed' and self.end_time < now:
+ self.extra_time = time
+ quiz_time = self.question_paper.quiz.duration
+ self.start_time = now - timezone.timedelta(minutes=quiz_time)
+ self.end_time = now + timezone.timedelta(minutes=time)
+ self.status = 'inprogress'
self.save()
def time_left(self):
diff --git a/yaksh/templates/yaksh/monitor.html b/yaksh/templates/yaksh/monitor.html
index 183ba99..0a8e3e9 100644
--- a/yaksh/templates/yaksh/monitor.html
+++ b/yaksh/templates/yaksh/monitor.html
@@ -116,6 +116,7 @@ $(document).ready(function()
<th> Attempts&nbsp;<i class="fa fa-sort"></i> </th>
<th> Time Left&nbsp;<i class="fa fa-sort"></i> </th>
<th> Status&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Extend time&nbsp;<i class="fa fa-sort"></i> </th>
<th> Special Attempt&nbsp;<i class="fa fa-sort"></i> </th>
</tr>
</thead>
@@ -132,18 +133,21 @@ $(document).ready(function()
<td> {{ paper.answers.count }} </td>
<td id="time_left{{forloop.counter0}}"> {{ paper.time_left }} </td>
<td> {% if paper.is_attempt_inprogress %}
- <form method="post" action="{% url 'yaksh:extend_time' paper.id %}">
- {% csrf_token %}
- <div class="form-group">
- <label for="extra_time"> Time in mins </label>
- <input type="number" class="form-control" id="extra_time" name="extra_time" required>
- </div>
- <button type="submit" class="btn btn-primary">Extend Time</button>
- </form>
+ <span class="badge badge-secondary"> Inprogress </span>
{% else %}
<span class="badge badge-secondary"> Completed </span>
{% endif %}
</td>
+ <td>
+ <form method="post" action="{% url 'yaksh:extend_time' paper.id %}">
+ {% csrf_token %}
+ <div class="form-group">
+ <label for="extra_time"> Time in mins </label>
+ <input type="number" step="any" class="form-control" id="extra_time" name="extra_time" required>
+ </div>
+ <button type="submit" class="btn btn-primary">Extend Time</button>
+ </form>
+ </td>
<td>{% specail_attempt_monitor paper.user.id course.id quiz.id %}</td>
</tr>
{% endfor %}
diff --git a/yaksh/views.py b/yaksh/views.py
index 4c3b4a6..b6f935b 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -3604,8 +3604,7 @@ def allow_special_attempt(request, user_id, course_id, quiz_id):
student.get_full_name())
messages.info(request, msg)
- return my_redirect('/exam/manage/monitor/{0}/{1}/'.format(quiz_id,
- course_id))
+ return redirect('yaksh:monitor', quiz_id, course_id)
@login_required
@@ -3754,8 +3753,8 @@ def revoke_special_attempt(request, micromanager_id):
msg = 'Revoked special attempt for {}'.format(
micromanager.student.get_full_name())
messages.info(request, msg)
- return my_redirect('/exam/manage/monitor/{0}/{1}/'.format(
- micromanager.quiz.id, course.id))
+ return redirect(
+ 'yaksh:monitor', micromanager.quiz.id, course.id)
@login_required
@@ -3790,7 +3789,7 @@ def extend_time(request, paper_id):
raise Http404('This course does not belong to you')
if request.method == "POST":
- extra_time = request.POST.get('extra_time', None)
+ extra_time = float(request.POST.get('extra_time', 0))
if extra_time is None:
msg = 'Please provide time'
else:
@@ -3800,8 +3799,9 @@ def extend_time(request, paper_id):
else:
msg = 'Bad Request'
messages.info(request, msg)
- return my_redirect('/exam/manage/monitor/{0}/{1}/'.format(
- anspaper.question_paper.quiz.id, course.id))
+ return redirect(
+ 'yaksh:monitor', anspaper.question_paper.quiz.id, course.id
+ )
@login_required