summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py7
-rw-r--r--yaksh/templates/yaksh/micromanaged.html2
-rw-r--r--yaksh/templates/yaksh/monitor.html16
-rw-r--r--yaksh/urls.py2
-rw-r--r--yaksh/views.py12
5 files changed, 30 insertions, 9 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 16800fe..11ddf8a 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -2037,8 +2037,11 @@ class AnswerPaperManager(models.Manager):
def _get_per_tc_data(answers, q_type):
tc = []
for answer in answers["answer"]:
- ans = literal_eval(answer) if answer else None
- tc.extend(ans) if q_type == "mcc" else tc.append(str(ans))
+ try:
+ ans = literal_eval(answer) if answer else None
+ tc.extend(ans) if q_type == "mcc" else tc.append(str(ans))
+ except Exception:
+ pass
return dict(Counter(tc))
df = pd.DataFrame(answers)
if not df.empty:
diff --git a/yaksh/templates/yaksh/micromanaged.html b/yaksh/templates/yaksh/micromanaged.html
index 5d7e58c..5339d71 100644
--- a/yaksh/templates/yaksh/micromanaged.html
+++ b/yaksh/templates/yaksh/micromanaged.html
@@ -12,7 +12,7 @@
Start Special Attempt
</a>
{% else %}
- <span class="badge badge-secondary">Exhausted</span>
+ <span class="badge badge-warning badge-pill">Exhausted</span>
{% endif %}
</div>
{% endif %}
diff --git a/yaksh/templates/yaksh/monitor.html b/yaksh/templates/yaksh/monitor.html
index 9b10b58..c7755e7 100644
--- a/yaksh/templates/yaksh/monitor.html
+++ b/yaksh/templates/yaksh/monitor.html
@@ -124,6 +124,22 @@ $(document).ready(function()
</div>
</div>
<br>
+ <div class="row">
+ <div class="col-md-3">
+ <b>Select Attempt number:</b>
+ </div>
+ <div class="col-md-2">
+ <select id="attempt" onchange="window.location.href=this.value" class="custom-select">
+ <option selected="">Select</option>
+ {% for attempt in attempt_numbers %}
+ <option value="{% url 'yaksh:monitor' quiz.id course.id attempt %}">
+ {{attempt}}
+ </option>
+ {% endfor %}
+ </select>
+ </div>
+ </div>
+ <br>
<div class="card">
{% if total_papers > 10 %}
<div class="table-responsive" style="height: 800px">
diff --git a/yaksh/urls.py b/yaksh/urls.py
index b7d8ff6..ba10265 100644
--- a/yaksh/urls.py
+++ b/yaksh/urls.py
@@ -100,6 +100,8 @@ urlpatterns = [
url(r'^manage/monitor/$', views.monitor, name="monitor"),
url(r'^manage/monitor/(?P<quiz_id>\d+)/(?P<course_id>\d+)/$',
views.monitor, name="monitor"),
+ url(r'^manage/monitor/(?P<quiz_id>\d+)/(?P<course_id>\d+)/(?P<attempt_number>\d+)/$',
+ views.monitor, name="monitor"),
url(r'^manage/user_data/(?P<user_id>\d+)/(?P<questionpaper_id>\d+)/'
'(?P<course_id>\d+)/$',
views.user_data, name="user_data"),
diff --git a/yaksh/views.py b/yaksh/views.py
index 1225b0e..1965191 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1365,7 +1365,7 @@ def show_statistics(request, questionpaper_id, attempt_number=None,
@login_required
@email_verified
-def monitor(request, quiz_id=None, course_id=None):
+def monitor(request, quiz_id=None, course_id=None, attempt_number=1):
"""Monitor the progress of the papers taken so far."""
user = request.user
@@ -1382,15 +1382,15 @@ def monitor(request, quiz_id=None, course_id=None):
attempt_numbers = AnswerPaper.objects.get_attempt_numbers(
q_paper.id, course.id
)
- latest_attempt_num = max(list(attempt_numbers)) if attempt_numbers else 0
questions_count = 0
questions_attempted = {}
completed_papers = 0
inprogress_papers = 0
papers = AnswerPaper.objects.filter(
- question_paper_id=q_paper.id,
- course_id=course_id, attempt_number=latest_attempt_num
+ question_paper_id=q_paper.id, attempt_number=attempt_number,
+ course_id=course_id
).order_by('user__first_name')
+ papers = papers.filter(attempt_number=attempt_number)
if not papers.exists():
messages.warning(request, "No AnswerPapers found")
else:
@@ -1842,10 +1842,10 @@ def download_quiz_csv(request, course_id, quiz_id):
attempt_number=attempt_number
).order_by("user__first_name")
que_summaries = [
- (f"{que.summary}-{que.points}-marks", que.id) for que in questions
+ (f"Q-{que.id}-{que.summary}-{que.points}-marks", que.id) for que in questions
]
user_data = list(answerpapers.values(
- "user__first_name", "user__last_name",
+ "user__username", "user__first_name", "user__last_name",
"user__profile__roll_number", "user__profile__institute",
"user__profile__department", "marks_obtained",
"question_paper__total_marks", "percent", "status"