diff options
author | adityacp | 2017-03-31 16:37:07 +0530 |
---|---|---|
committer | adityacp | 2017-04-10 11:51:08 +0530 |
commit | bd8c2c653a06e29dcf7a1a0103f7735f46f0c488 (patch) | |
tree | aebb26c0e61f9d4050a2a44e0f9441de820956a6 | |
parent | 592353ba30178654975f4c64602414cac7f41a9d (diff) | |
download | online_test-bd8c2c653a06e29dcf7a1a0103f7735f46f0c488.tar.gz online_test-bd8c2c653a06e29dcf7a1a0103f7735f46f0c488.tar.bz2 online_test-bd8c2c653a06e29dcf7a1a0103f7735f46f0c488.zip |
Change in templates and js and urls
- Add urls to download quiz assignments in urls.p
- Catch Http404 exception message in 404.html template
- Add download assignment links for quiz in grade_user.html
- Fix javascript validation in add_question.js
-rw-r--r-- | yaksh/static/yaksh/js/add_question.js | 3 | ||||
-rw-r--r-- | yaksh/templates/404.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 60 | ||||
-rw-r--r-- | yaksh/urls.py | 4 |
4 files changed, 42 insertions, 27 deletions
diff --git a/yaksh/static/yaksh/js/add_question.js b/yaksh/static/yaksh/js/add_question.js index 05752b4..5bec8c6 100644 --- a/yaksh/static/yaksh/js/add_question.js +++ b/yaksh/static/yaksh/js/add_question.js @@ -122,9 +122,8 @@ function textareaformat() }); document.getElementById('my').innerHTML = document.getElementById('id_description').value ; - if (document.getElementById('id_grade_assignment_upload').checked || - document.getElementById('id_type').val() == 'upload'){ + document.getElementById('id_type').value == 'upload'){ $("#id_grade_assignment_upload").prop("disabled", false); } else{ diff --git a/yaksh/templates/404.html b/yaksh/templates/404.html index 7d33dd3..8d43ec5 100644 --- a/yaksh/templates/404.html +++ b/yaksh/templates/404.html @@ -1,5 +1,5 @@ {% extends "base.html" %} {% block content %} -The requested page does not exist. +{{ exception }} {% endblock %} diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 1cb1f99..69c03c9 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -46,7 +46,11 @@ </div> {% endif %} +{% if quiz_file_status %} +<a href="{{URL_ROOT}}/exam/manage/download/quiz_assignments/{{quiz_id}}/"> + Download All Assignments</a> +{% endif %} <div id = "paper" class="col-md-10"> {% if data %} @@ -69,7 +73,6 @@ {{ paper.total_marks }} <h3> Quiz: {{ paper.question_paper.quiz.description }} </h3> - <p> Attempt Number: <b>{{paper.attempt_number}} </b> <select id = "attempt" onchange="window.location.href=this.value"> @@ -80,7 +83,6 @@ Attempt Number: <b>{{paper.attempt_number}} </b> </option> {% endfor %} </select> - <br/>Questions correctly answered: {{ paper.get_answered_str }} <br/> Total attempts at questions: {{ paper.answers.count }} <br/> Marks obtained: {{ paper.marks_obtained }} <br/> @@ -95,7 +97,6 @@ Status : <b style="color: red;"> Failed </b><br/> Status : <b style="color: green;"> Passed </b><br/> {% endif %} </p> - {% if paper.answers.count %} <h4> Report </h4><br> @@ -122,8 +123,8 @@ Status : <b style="color: green;"> Passed </b><br/> {% endif %} method="post"> {% csrf_token %} -{% for question, answers in paper.get_question_answers.items %} +{% for question, answers in paper.get_question_answers.items %} <div class="panel panel-info"> <div class="panel-heading"> <strong> Details: {{forloop.counter}}. {{ question.summary }} @@ -153,7 +154,6 @@ Status : <b style="color: green;"> Passed </b><br/> <strong>{{ testcase.error_margin|safe }}</strong> {% endif %} {% endfor %} - {% else %} <h5> <u>Test cases: </u></h5> {% for testcase in question.get_test_cases %} @@ -163,29 +163,41 @@ Status : <b style="color: green;"> Passed </b><br/> </div> </div> <h5>Student answer: </h5> - {% for ans in answers %} - {% if ans.answer.correct %} - <div class="panel panel-success"> - <div class="panel-heading">Correct answer: + {% if question.type == "upload" %} + {% if user_file_status %} + <a href="{{URL_ROOT}}/exam/manage/download/user_assignment/{{question.id}}/{{data.user.id}}/{{paper.question_paper.id}}"> + <div class="panel"> + Assignment File for {{ data.user.get_full_name.title }} + </div> + </a> + {% else %} + <h5>No Assignment submitted by {{ data.user.get_full_name.title }}</h5> + {% endif %} + {% else %} + {% for ans in answers %} + {% if ans.answer.correct %} + <div class="panel panel-success"> + <div class="panel-heading">Correct answer: + {% else %} + <div class="panel panel-danger"> + <div class="panel-heading">Error: + {% endif %} + {% for err in ans.error_list %} + <div><pre>{{ err }}</pre></div> + {% endfor %} + </div> + <div class="panel-body"> + {% if question.type != "code" %} + <div class="well well-sm"> + {{ ans.answer.answer.strip|safe }} + </div> {% else %} - <div class="panel panel-danger"> - <div class="panel-heading">Error: + <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre> {% endif %} - {% for err in ans.error_list %} - <div><pre>{{ err }}</pre></div> + </div> + </div> {% endfor %} - </div> - <div class="panel-body"> - {% if question.type != "code" %} - <div class="well well-sm"> - {{ ans.answer.answer.strip|safe }} - </div> - {% else %} - <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre> {% endif %} - </div> - </div> - {% endfor %} {% with answers|last as answer %} Marks: <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" diff --git a/yaksh/urls.py b/yaksh/urls.py index 00b34e4..445b828 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -91,4 +91,8 @@ urlpatterns = [ url(r'^manage/create_demo_course/$', views.create_demo_course), url(r'^manage/courses/download_course_csv/(?P<course_id>\d+)/$', views.download_course_csv), + url(r'^manage/download/user_assignment/(?P<question_id>\d+)/(?P<user_id>\d+)/(?P<questionpaper_id>\d+)/$', + views.download_assignment_file), + url(r'^manage/download/quiz_assignments/(?P<questionpaper_id>\d+)/$', + views.download_assignment_file) ] |