summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2020-01-24 09:40:17 +0530
committeradityacp2020-01-24 09:40:17 +0530
commitebbb1b4d3dcec668b901200de7b31253162da80c (patch)
treee142e921193927a37182d0d1a964fbe80bf52d82 /yaksh
parent1a485a73245e10e4f2c49e10e376eaa8f2f2ca8c (diff)
downloadonline_test-ebbb1b4d3dcec668b901200de7b31253162da80c.tar.gz
online_test-ebbb1b4d3dcec668b901200de7b31253162da80c.tar.bz2
online_test-ebbb1b4d3dcec668b901200de7b31253162da80c.zip
Change in views, forms and templates
- Add django messages for showing success, warning messages - Add pagination in monitor and grade user - Remove unnecessary template blocks - Show add and view options for quizzes, lessons, modules - Add form-control bootstrap class for multiple forms - Fix the UI in grade user and monitor pages - Add font awesome icons in the login page
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/forms.py7
-rw-r--r--yaksh/static/yaksh/css/custom.css8
-rw-r--r--yaksh/static/yaksh/js/course.js2
-rw-r--r--yaksh/templates/yaksh/add_exercise.html125
-rw-r--r--yaksh/templates/yaksh/add_module.html2
-rw-r--r--yaksh/templates/yaksh/add_quiz.html26
-rw-r--r--yaksh/templates/yaksh/course_detail.html6
-rw-r--r--yaksh/templates/yaksh/courses.html10
-rw-r--r--yaksh/templates/yaksh/design_questionpaper.html2
-rw-r--r--yaksh/templates/yaksh/grade_user.html804
-rw-r--r--yaksh/templates/yaksh/lessons.html90
-rw-r--r--yaksh/templates/yaksh/login.html6
-rw-r--r--yaksh/templates/yaksh/moderator_dashboard.html5
-rw-r--r--yaksh/templates/yaksh/modules.html117
-rw-r--r--yaksh/templates/yaksh/monitor.html346
-rw-r--r--yaksh/templates/yaksh/quizzes.html126
-rw-r--r--yaksh/templates/yaksh/statistics_question.html41
-rw-r--r--yaksh/templates/yaksh/user_data.html596
-rw-r--r--yaksh/urls.py2
-rw-r--r--yaksh/views.py65
20 files changed, 1484 insertions, 902 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 5a3925e..414bff5 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -216,6 +216,13 @@ class UserLoginForm(forms.Form):
class ExerciseForm(forms.ModelForm):
+
+ def __init__(self, *args, **kwargs):
+ super(ExerciseForm, self).__init__(*args, **kwargs)
+ self.fields['description'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder':"Exercise Description"}
+ )
+
class Meta:
model = Quiz
fields = ['description', 'view_answerpaper', 'active']
diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css
index 2f62a26..8623bfb 100644
--- a/yaksh/static/yaksh/css/custom.css
+++ b/yaksh/static/yaksh/css/custom.css
@@ -15,11 +15,15 @@ body, .dropdown-menu {
display: flex;
}
-.course-detail {
+.course-detail, #result-table {
table-layout: fixed;
width: 100%;
}
-.course-detail > th, td {
+.course-detail, #result-table > th, td {
word-wrap: break-word;
+}
+
+#rendered_text{
+ width: 550px;
} \ No newline at end of file
diff --git a/yaksh/static/yaksh/js/course.js b/yaksh/static/yaksh/js/course.js
index 29d2d9a..7b3c5d9 100644
--- a/yaksh/static/yaksh/js/course.js
+++ b/yaksh/static/yaksh/js/course.js
@@ -125,7 +125,7 @@ $(document).ready(function(){
$('[data-toggle="tab"]').tooltip({
trigger: 'hover',
placement: 'top',
- animate: true,
+ animate: false,
container: 'body'
});
}); // end document ready
diff --git a/yaksh/templates/yaksh/add_exercise.html b/yaksh/templates/yaksh/add_exercise.html
index 21ef6cc..c1813bf 100644
--- a/yaksh/templates/yaksh/add_exercise.html
+++ b/yaksh/templates/yaksh/add_exercise.html
@@ -1,54 +1,99 @@
{% extends "manage.html" %}
-
+{% load static %}
{% block subtitle %}Add Exercise{% endblock %}
{% block css %}
{% endblock %}
{% block script %}
-<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-3.3.1.min.js"></script>
-<script src="{{ URL_ROOT }}/static/yaksh/js/add_quiz.js"></script>
+<script src="{% static 'yaksh/js/jquery-3.3.1.min.js' %}"></script>
+<script src="{% static 'yaksh/js/add_quiz.js' %}"></script>
{% endblock %}
{% block onload %} window.onload="javascript:test();" {% endblock %}
{% block content %}
-<div class="yakshwell container">
-<form name=frm id=frm action="" method="post" >
- {% csrf_token %}
- <center>
- <table class="span1 table table-responsive-sm">
- {{ form.as_table }}
- </table>
- <br/><br/>
- </center>
- <center><button class="btn btn-success" type="submit" id="submit" name="save_exercise"> Save
- </button>
-
- <button class="btn btn-danger" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button> </center>
-</form>
-{% if exercise and course_id %}
- {% if exercise.questionpaper_set.get.id %}
- <center>
- <h4>You can check the quiz by attempting it in the following modes:</h4>
- <a href="{{URL_ROOT}}/exam/manage/designquestionpaper/{{ exercise.id }}/{{exercise.questionpaper_set.get.id}}/{{course_id}}" class="btn btn-primary">View Question Paper</a>
- <button class="btn" type="button" name="button" onClick='usermode("{{URL_ROOT}}/exam/manage/usermode/{{exercise.id}}/{{course_id}}/");'>User Mode</button>
+<div class="container">
+ {% if messages %}
+ {% for message in messages %}
+ <div class="alert alert-dismissible alert-{{ message.tags }}">
+ <button type="button" class="close" data-dismiss="alert">
+ <i class="fa fa-close"></i>
+ </button>
+ <strong>{{ message }}</strong>
+ </div>
+ {% endfor %}
+ {% endif %}
+ {% if course_id %}
+ <a class="btn btn-primary" href="{% url 'yaksh:get_course_modules' course_id %}">
+ <i class="fa fa-arrow-left"></i>
+ Back
+ </a>
+ {% else %}
+ <a class="btn btn-primary" href="{% url 'yaksh:show_all_quizzes' %}">
+ <i class="fa fa-arrow-left"></i>
+ Back
+ </a>
+ {% endif %}
+ <br><br>
+ <form name=frm id=frm action="" method="post" >
+ {% csrf_token %}
+ <center>
+ <table class="span1 table table-responsive-sm">
+ {{ form.as_table }}
+ </table>
+ <br/><br/>
+ </center>
+ <center>
+ <button class="btn btn-success btn-lg" type="submit" id="submit" name="save_exercise">
+ <i class="fa fa-save"></i>&nbsp;Save
+ </button>
+ </center>
+ </form>
+ {% if exercise and course_id %}
+ {% if exercise.questionpaper_set.get.id %}
+ <center>
+ <a href="{% url 'yaksh:designquestionpaper' exercise.id exercise.questionpaper_set.get.id course_id %}" class="btn btn-primary">
+ <i class="fa fa-edit"></i> Edit Question Paper
+ </a>
+ <a href="{% url 'yaksh:preview_questionpaper' exercise.questionpaper_set.get.id %}" class="btn btn-info" target="_blank">
+ <i class="fa fa-eye"></i> Preview Question Paper
+ </a>
+ <br>
+ <br>
+ <h4>You can check the quiz by attempting it in the following modes:</h4>
+ <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'usermode' exercise.id course_id %}" target="blank">
+ User Mode
+ </a>
- <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/godmode/{{exercise.id}}/{{course_id}}/");'>
- God Mode</button>
- <a data-toggle="collapse" data-target="#help">
- <span class="glyphicon glyphicon-info-sign">Help</span></a>
- <div id="help" class="collapse">
- <br/>
- <ul>
- <li><b>User Mode:</b> Attempt quiz the way normal users will attempt i.e. -
- <ul>
- <li><i>Quiz will have the same duration as that of the original quiz.</li>
- <li>Quiz won't start if the course is inactive or the quiz time has expired.</li>
- <li>You will be notified about quiz prerequisites.(You can still attempt the quiz though)</i></li>
- </ul>
- </p>
- <li> <b>God Mode:</b> Attempt quiz without any time or eligibilty constraints.</p>
- </div>
+ <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'godmode' exercise.id course_id %}" target="blank">
+ God Mode
+ </a>
+ <a data-toggle="modal" data-target="#help">
+ <span class="text-info"><i class="fa fa-info-circle"></i> Help</span></a>
+ </center>
+ {% endif %}
{% endif %}
-{% endif %}
+</div>
+<div class="modal" id="help">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title">Quiz Test Modes</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true"><i class="fa fa-close"></i></span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <p>
+ <b>User Mode:</b> Attempt quiz the way normal users will attempt i.e. -
+ <ul class="list-group list-group-flush">
+ <li class="list-group-item">Quiz will have the same duration as that of the original quiz.</li>
+ <li class="list-group-item">Quiz won't start if the course is inactive or the quiz time has expired.</li>
+ <li class="list-group-item">You will be notified about quiz prerequisites.(You can still attempt the quiz though)</li>
+ </ul>
+ <b>God Mode:</b> Attempt quiz without any time or eligibilty constraints.
+ </p>
+ </div>
+ </div>
+ </div>
</div>
{% endblock %}
diff --git a/yaksh/templates/yaksh/add_module.html b/yaksh/templates/yaksh/add_module.html
index d659ff2..edbfaa2 100644
--- a/yaksh/templates/yaksh/add_module.html
+++ b/yaksh/templates/yaksh/add_module.html
@@ -36,7 +36,7 @@
Back
</a>
{% else %}
- <a class="btn btn-primary" href="{% url 'yaksh:show_all_lessons' %}">
+ <a class="btn btn-primary" href="{% url 'yaksh:show_all_modules' %}">
<i class="fa fa-arrow-left"></i>
Back
</a>
diff --git a/yaksh/templates/yaksh/add_quiz.html b/yaksh/templates/yaksh/add_quiz.html
index 1e3c425..57b4d77 100644
--- a/yaksh/templates/yaksh/add_quiz.html
+++ b/yaksh/templates/yaksh/add_quiz.html
@@ -35,7 +35,7 @@
Back
</a>
{% else %}
- <a class="btn btn-primary" href="{% url 'yaksh:show_all_lessons' %}">
+ <a class="btn btn-primary" href="{% url 'yaksh:show_all_quizzes' %}">
<i class="fa fa-arrow-left"></i>
Back
</a>
@@ -69,23 +69,19 @@
</a>
<br>
<br>
- <h4>You can check the quiz by attempting it in the following modes:</h4>
- <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'usermode' quiz.id course_id %}" target="blank">
- User Mode
- </a>
+ <h4>You can check the quiz by attempting it in the following modes:</h4>
+ <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'usermode' quiz.id course_id %}" target="blank">
+ User Mode
+ </a>
- <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'godmode' quiz.id course_id %}" target="blank">
- God Mode
- </a>
- <a data-toggle="modal" data-target="#help">
- <span class="text-info"><i class="fa fa-info-circle"></i> Help</span></a>
+ <a class="btn btn-outline-info" name="button" href="{% url 'yaksh:test_quiz' 'godmode' quiz.id course_id %}" target="blank">
+ God Mode
+ </a>
+ <a data-toggle="modal" data-target="#help">
+ <span class="text-info"><i class="fa fa-info-circle"></i> Help</span></a>
+ </center>
{% endif %}
{% endif %}
- <style type="text/css">
- #rendered_text{
- width: 550px;
- }
- </style>
</div>
<div class="modal" id="help">
<div class="modal-dialog" role="document">
diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html
index 2617c61..654f373 100644
--- a/yaksh/templates/yaksh/course_detail.html
+++ b/yaksh/templates/yaksh/course_detail.html
@@ -12,12 +12,6 @@
{% endblock %}
{% block css %}
<link rel="stylesheet" href="{% static 'yaksh/css/jquery-ui/jquery-ui.css' %}">
-<style>
- .user_data + .tooltip.top > .tooltip-inner {
- padding: 12px;
- font-size: 8px;
- }
-</style>
{% endblock %}
<div class="text-center">
diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html
index c8897aa..de8684f 100644
--- a/yaksh/templates/yaksh/courses.html
+++ b/yaksh/templates/yaksh/courses.html
@@ -35,16 +35,16 @@
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">More</a>
<div class="dropdown-menu hide" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 37px, 0px); top: 0px; left: 0px; will-change: transform;">
<a class="dropdown-item" href="{% url 'yaksh:show_all_quizzes' %}">
- View Quizzes
+ Add/View Quizzes
</a>
<a class="dropdown-item" href="{% url 'yaksh:show_all_lessons' %}">
- View Lessons
+ Add/View Lessons
</a>
<a class="dropdown-item" href="{% url 'yaksh:show_all_modules' %}">
- View Modules
+ Add/View Modules
</a>
<a href="{% url 'grades:grading_systems'%}" class="dropdown-item" >
- View Grading Systems
+ Add/View Grading Systems
</a>
</div>
</li>
@@ -62,7 +62,7 @@
<hr>
{% if messages %}
{% for message in messages %}
- <div class="alert alert-dismissible alert-info">
+ <div class="alert alert-dismissible alert-{{ message.tags }}">
<button type="button" class="close" data-dismiss="alert">
<i class="fa fa-close"></i>
</button>
diff --git a/yaksh/templates/yaksh/design_questionpaper.html b/yaksh/templates/yaksh/design_questionpaper.html
index 9839bbf..6e916a3 100644
--- a/yaksh/templates/yaksh/design_questionpaper.html
+++ b/yaksh/templates/yaksh/design_questionpaper.html
@@ -24,7 +24,7 @@
</a>
{% else %}
<form action="{% url 'yaksh:designquestionpaper' qpaper.quiz.id qpaper.id %}" method="POST" id="design_q">
- <a href="{% url 'yaksh:show_all_quizzes' %}" class="btn btn-danger">
+ <a href="{% url 'yaksh:show_all_quizzes' %}" class="btn btn-primary">
<i class="fa fa-arrow-left"></i>&nbsp;Back
</a>
{% endif %}
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index a76f2c7..9311590 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -1,15 +1,15 @@
{% extends "manage.html" %}
{% load custom_filters %}
+{% load static %}
{% block title %} Grade User {% endblock %}
{% block pagetitle %} Grade User {% endblock pagetitle %}
-{% block content %}
-<div class="yakshwell container">
{% block script %}
-<script src="{{ URL_ROOT }}/static/yaksh/js/jquery.tablesorter.min.js"></script>
-<script src="{{ URL_ROOT }}/static/yaksh/js/mathjax/MathJax.js?config=TeX-MML-AM_CHTML"></script>
+<script type="text/javascript" src="{% static 'yaksh/js/jquery.tablesorter.min.js' %}">
+</script>
+<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script>
<script type="text/javascript">
$(document).ready(function()
{
@@ -19,371 +19,463 @@ $(document).ready(function()
</script>
{% endblock script %}
-{% if course_details %}
-<div class="table-wrapper-2">
- <table id="course-details" class="table table-bordered table-responsive-sm">
- <tr class="yakshlabel yakshred text-center">
- <th><i class="fa fa-book"></i> Courses</th>
- <th><i class="fa fa-puzzle-piece"></i> Quizzes </th>
- </tr>
-
- {% for course in course_details %}
- <tr>
- <td><ul class="list-group">{{course.name}} </td>
-
- {% if course.get_quizzes %}
- <td>
- {% for quiz in course.get_quizzes %}
- <li class="list-group-item"><a href = "{{URL_ROOT}}/exam/manage/gradeuser/{{quiz.id}}/{{course.id}}/">
- {{quiz.description}}
- </a></li>
- {% endfor %}
- </td>
- {% else %}
- <td> No quiz</td>
- {% endif %}
- </ul></tr>
- {% endfor %}
- </table>
- </div>
-{% endif %}
-
-<div class="row">
-{% if not course_details %}
-{% if users %}
- <div id = "student" class="col-md-2">
- {% for user in users %}
- <p><a href = "{{URL_ROOT}}/exam/manage/gradeuser/{{quiz_id}}/{{user.user__id}}/{{course_id}}/" class="btn btn-primary">
- {{user.user__first_name}} {{user.user__last_name}}</a></p>
- {% endfor %}
+{% block content %}
+<div class="container">
+{% if objects %}
+ {% include "yaksh/paginator.html" %}
+ <div id="accordion">
+ {% for course in objects %}
+ <div class="card">
+ <div class="card-header">
+ <div class="row">
+ <div class="col-md-9">
+ <h5 data-toggle="tooltip" title="{{course.name}}">
+ {{ course.name }}
+ </h5>
+ </div>
+ <div class="col-md">
+ <a class="card-link btn btn-info" data-toggle="collapse" href="#collapse{{course.id}}">
+ Details
+ <i class="fa fa-toggle-down" id="toggle_course_{{course.id}}"></i>
+ </a>
+ </div>
+ </div>
+ </div>
+ <div id="collapse{{course.id}}" class="collapse hide" data-parent="#accordion">
+ <div class="card-body">
+ {% with course.get_quizzes as quizzes %}
+ {% if quizzes %}
+ <ul class="list-group">
+ {% for quiz in quizzes %}
+ <li class="list-group-item">
+ <div class="row">
+ <div class="col-md-8">
+ {{quiz.description}}
+ </div>
+ <div class="col-md-2">
+ <a href="{% url 'yaksh:grade_user' quiz.id course.id%}" class="btn btn-primary">
+ Grade
+ </a>
+ </div>
+ </div>
+ </li>
+ {% endfor %}
+ </ul>
+ {% else %}
+ <center>
+ <p class="badge badge-danger badge-pill">
+ No Quizzes
+ </p>
+ </center>
+ {% endif %}
+ {% endwith %}
+ </div>
+ </div>
+ </div>
+ <br>
+ {% endfor %}
</div>
-{% else %}
-<center>
- <div class="alert-warning alert animated flash">
-<h4>No Users Found for {{ quiz.description }}</h4>
-</center>
-{% endif %}
-{% endif %}
-
-{% if has_quiz_assignments %}
-
-<a href="{{URL_ROOT}}/exam/manage/download/quiz_assignments/{{quiz_id}}/{{course_id}}" class="btn btn-outline-info">
- Download All Assignments</a>
-{% endif %}
-
-<div id = "paper" class="col-md-10">
-{% if data %}
-
-
-<p> <h3> <center> Showing paper for {{data.user.get_full_name.title}} </center></h3>
-<p><b>Name:</b> {{ data.user.get_full_name.title }}
-{% if data.profile %}
-
-<p><b> Roll number:</b> {{ data.profile.roll_number }}
-<p><b>Position: </b> {{ data.profile.position }}
-<p><b>Department: </b>{{ data.profile.department }}
-<p><b>Institute: </b>{{ data.profile.institute }}
+ {% include "yaksh/paginator.html" %}
{% endif %}
-
-{% if data.papers %}
-
-{% for paper in data.papers %}
-<hr>
-{{ paper.total_marks }}
-
-<h4> Course: {{ paper.question_paper.quiz.course.name }}</h4>
-<h4> Quiz: {{ paper.question_paper.quiz.description }} </h4>
-
-<p>
-Attempt Number: <b>{{paper.attempt_number}} </b>
-<select id = "attempt" onchange="window.location.href=this.value">
-<option selected="">Select attempt number</option>
-{%for attempt in attempts %}
-<option value = "{{URL_ROOT}}/exam/manage/gradeuser/{{quiz_id}}/{{user_id}}/{{attempt.attempt_number}}/{{course_id}}/">
-{{attempt.attempt_number}}
-</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/>
-Start time: {{ paper.start_time }} <br/>
-End time: {{ paper.end_time }} <br/>
-{%if paper.percent%}
-Percentage obtained: {{paper.percent}}% <br/>
-{% endif %}
-{% if paper.passed %}
-Status : <b style="color: green;"> Passed </b><br/>
-{% else %}
-Status : <b style="color: red;"> Failed </b><br/>
-{% endif %}
-</p>
-{% if paper.answers.count %}
-
-<h4> Report </h4><br>
-<table class="tablesorter table table-striped table-bordered table-responsive-sm" id ='marks_table'>
- <thead>
- <tr class="yakshlabel text-center yakshred">
- <th>Question Id</th>
- <th>Questions</th>
- <th>Marks Obtained</th>
- </tr>
- </thead>
- <tbody>
- {% for question, answers in paper.get_question_answers.items %}
- {% with answers|last as answer %}
- <tr>
- <td>{{question.id}}</td>
- <td><a href="#question_{{question.id}}">{{ question.summary }}</a></td>
- <td>{{ answer.answer.marks }}</td>
- </tr>
- {% endwith %}
- {% endfor %}
- </tbody>
-</table>
-
-<div class="table-wrapper-2">
-<h3> Answers </h3><br>
-<form name=frm id="q{{ paper.quiz.id }}_form"
- action="{{URL_ROOT}}/exam/manage/gradeuser/{{quiz_id}}/{{user_id}}/{{paper.attempt_number}}/{{course_id}}/"
- method="post">
-{% csrf_token %}
-
-{% for question, answers in paper.get_question_answers.items %}
-<div class = "yakshlabel">
-<div class="card">
- <div class="card-heading alert-info" id="question_{{question.id}}">
- <strong> Details: {{forloop.counter}}. {{ question.summary }}
- <span class="marks pull-right"> Mark(s): {{ question.points }} </span>
- </strong>
- </div>
- <div class="card-body">
- <h5><u>Question:</u></h5> <strong>{{ question.description|safe }}</strong>
- {% if question.type == "mcq" or question.type == "mcc" %}
- <h5> <u>Choices:</u></h5>
- {% for testcase in question.get_test_cases %}
- {% if testcase.correct %}
- <br/>
- <strong>{{ forloop.counter }}. {{ testcase.options }}</strong>
- <span class="alert alert-success"> Correct </span>
- {% else %}
- <br/><strong>
- {{ forloop.counter }}. {{ testcase.options }}</strong>
- {% endif %}
- {% endfor %}
-
- {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
- <h5> <u>Correct Answer:</u></h5>
- {% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct }}</strong>
- {% if testcase.error_margin %}
- <strong>{{ testcase.error_margin }}</strong>
- {% endif %}
- {% endfor %}
- {% elif question.type == "arrange" %}
- <h5> <u>Correct Order:</u></h5>
- <div class="list-group" >
- {% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options }}</strong></li>
- {% endfor %}
- </div>
-
- {% else %}
- <h5> <u>Test cases: </u></h5>
- {% for testcase in question.get_test_cases %}
- <br/><strong>{{ forloop.counter }}. {{ testcase }}</strong>
- {% endfor %}
- {%endif%}
+</div>
+<div class="container-fluid">
+ <div class="row">
+ {% if not objects %}
+ {% if users %}
+ <div id="student" class="col-md-3">
+ <ul class="nav nav-pills list-group">
+ {% for user in users %}
+ <li class="nav-item">
+ <a href="{% url 'yaksh:grade_user' quiz_id user.user__id course_id %}" class="list-group-item{% if user.user__id == data.user.id %} active {% endif %}">
+ {{user.user__first_name}} {{user.user__last_name}}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
</div>
- </div>
- <h5>Student answer: </h5>
- {% if question.type == "upload" %}
- {% if has_user_assignments %}
- <a href="{{URL_ROOT}}/exam/manage/download/user_assignment/{{question.id}}/{{data.user.id}}/{{paper.question_paper.quiz.id}}/{{course_id}}">
- <div class="btn btn-outline-info text-center">
- Assignment File for {{ data.user.get_full_name.title }}
+ {% else %}
+ <div class="col-md-1"></div>
+ <div class="col-md-10">
+ <div class="alert alert-warning">
+ <center>
+ <h4>No Users Found for {{ quiz.description }}</h4>
+ </center>
+ </div>
</div>
- </a>
- {% with answers|last as answer%}
- {% if answer.answer.correct %}
- <div class="card ">
- <div class="card-heading alert-success">Correct answer</div></div>
- {% else %}
- <div class="card ">
- <div class="card-heading alert-danger">Incorrect Answer</div></div>
- {% endif %}
- {% endwith %}
- {% else %}
- <center>
- <div class="alert alert-warning animated flash">
- <h5>No Assignment submitted by {{ data.user.get_full_name.title }}</h5>
- </div>
- </center>
+ {% endif %}
{% endif %}
- {% else %}
- {% for ans in answers %}
- {% if ans.answer.correct %}
- <div class="card ">
- <div class="card-heading alert-success">Correct answer:
- {% else %}
- <div class="card ">
- <div class="card-heading-heading alert-danger">Error:
- {% endif %}
- {% with ans.error_list as err %}
- {% for error in err %}
- {% if error.type == 'stdio' %}
- <div class = "card">
- <div class="card-body">
- {% if error.given_input %}
- <table class="table table-bordered table-responsive-sm">
- <col width="30%">
- <tr class = "table-active">
- <td> For given Input value(s):</td>
- <td>{{error.given_input}}</td>
- </tr>
- </table>
- {% endif %}
- <table class="table table-bordered table-responsive-sm" width="100%" id="output" style="table-layout: fixed">
- <col width="10%">
- <col width="40%">
- <col width="40%">
- <col width="10%">
- <tr>
- <th><center>Line No.</center></th>
- <th><center>Expected Output</center></th>
- <th><center>User output</center></th>
- <th><center>Status</center></th>
- </tr>
- {% for expected,user in error.expected_output|zip:error.user_output %}
- <td> {{forloop.counter}} </td>
- <td>{{expected|default:""}} </td>
- <td>{{user|default:""}}</td>
- {% if forloop.counter0 in error.error_line_numbers or not expected or not user %}
- <td><span class ="fa fa-times text-warning"/></td>
- {% else %}
- <td><span class ="fa fa-check text-success"/></td>
- {% endif %}
- </tr>
- {% endfor %}
- </table>
- <table width="100%" class="table table-bordered table-responsive-sm">
- <col width="10">
- <tr>
- <td><b>Error:</b></td>
- <td>{{error.error_msg}}</td>
- </tr>
- </table>
- </div>
- </div>
- {% elif error.type == 'assertion' %}
- {% if error.test_case %}
- <strong> We tried you code with the following test case:</strong><br/></br>
- <pre><code><strong style="color:#d9534f">{{error.test_case}}</strong></code></pre>
- {% endif %}
- <p> <b>The following error took place: </b></p>
- <div class="card">
- <div class="card-body">
- <table class="table table-bordered table-responsive-sm" width="100%" style="table-layout: fixed">
- <col width="30%">
- <tr class = "active">
- <td><b>Exception Name: </b></td>
- <td><span style="color: #d9534f">{{error.exception}}</span></td>
- </tr>
- <tr>
- <td><b>Exception Message: </b></td><td>{{error.message}}</td>
- </tr>
- <tr>
- {% if error.traceback %}
- <td><b>Full Traceback: </b></td>
- <td><pre>{{error.traceback}}</pre></td>
- {% endif %}
- </tr>
- </table>
- </div>
- </div> <!-- Closes card -->
- {% else %}
- <pre><code> {{error}} </code></pre>
- {% endif %}
- {% endfor %}
- {% endwith %}
- </div>
-
- <div class="card-body">
- {% if question.type == "code" %}
- <pre><code>{{ ans.answer.answer.strip }}</code></pre>
- {% elif question.type == "mcc"%}
- <div class="card">
- <div class="card-body">
- {% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in ans.answer.answer.strip %}
- <li>{{ testcases.options.strip }}</li>
- {% endif %}
- {% endfor %}
+ <div id="paper" class="col-md-9">
+ {% if has_quiz_assignments %}
+ <a href="{% url 'yaksh:download_quiz_assignment' quiz_id course_id %}" class="btn btn-outline-info">
+ <i class="fa fa-download"></i>&nbsp;Download All Assignments
+ </a>
+ <br><br>
+ {% endif %}
+
+ {% if messages %}
+ {% for message in messages %}
+ <div class="alert alert-dismissible alert-{{ message.tags }}">
+ <button type="button" class="close" data-dismiss="alert">
+ <i class="fa fa-close"></i>
+ </button>
+ <strong>{{ message }}</strong>
</div>
- </div>
- {% elif question.type == "mcq"%}
- <div class="card">
- <div class="card-body">
- {% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == ans.answer.answer.strip %}
- <li>{{ testcases.options.strip }}</li>
- {% endif %}
{% endfor %}
- </div>
- </div>
+ {% endif %}
- {% elif question.type == "arrange"%}
+ {% if data %}
<div class="card">
+ <div class="card-header">
+ Student Details
+ </div>
<div class="card-body">
- {% get_answer_for_arrange_options ans.answer.answer question as tc_list %}
- {% for testcases in tc_list %}
- <li>{{ testcases.options.strip }}</li>
- {% endfor %}
- </div>
- </div>
-
- {% else %}
- <div class="card">
- <div class="card-body">
- {{ ans.answer.answer.strip }}
+ <p><b>Name:</b> {{ data.user.get_full_name.title }}</p>
+ {% with data.profile as profile %}
+ {% if profile %}
+ <div class="row">
+ <div class="col-md-4">
+ <p><b> Roll number:</b> {{ profile.roll_number }}</p>
+ <p><b>Position: </b> {{ profile.position }}</p>
+ </div>
+ <div class="col-md-7">
+ <p><b>Department: </b>{{ profile.department }}</p>
+ <p><b>Institute: </b>{{ profile.institute }}</p>
+ </div>
+ </div>
+ {% endif %}
+ {% endwith %}
</div>
</div>
- {% endif %}
- </div>
- </div>
- {% endfor %}
- {% endif %}
- {% with answers|last as answer %}
- Marks: <input id="q{{ question.id }}" type="text"
- name="q{{ question.id }}_marks" size="4"
- value="{{ answer.answer.marks }}"><br><br>
- {% endwith %}
- <hr/>
- </div>
-
- {% endfor %} {# for question, answers ... #}
- </div>
-<div class="form-group">
-<h3>Teacher comments: </h3>
-<textarea id="comments_{{paper.question_paper.id}}" class="form-control"
- name="comments_{{ paper.question_paper.id }}">{{ paper.comments }}</textarea>
-</div>
-<br><button class="btn btn-primary" type="submit" name="submit_{{paper.quiz.id}}">Save Marks</button>
-
-</form>
-</div>
-
-{% endif %} {# if paper.answers.count #}
-
-
-{% endfor %} {# for paper in data.papers #}
-
-{% endif %} {# if data.papers #}
-{% else %}
+ <hr>
+ {% if data.papers %}
+ {% for paper in data.papers %}
+ <div class="card">
+ <div class="card-header">
+ Course Details
+ </div>
+ <div class="card-body">
+ <div class="row">
+ <div class="col-md-6">
+ <p><b>Course:</b> {{ paper.course.name }}</p>
+ <p><b>Quiz:</b> {{ paper.question_paper.quiz.description }}</p>
+ <p><b>Start time:</b> {{ paper.start_time }}</p>
+ <p><b>End time:</b> {{ paper.end_time }}</p>
+ <p><b>Status:</b>
+ {% if paper.passed %}
+ <span class="badge badge-pill badge-success"> Passed </span>
+ {% else %}
+ <span class="badge badge-pill badge-danger"> Failed </span>
+ {% endif %}
+ </p>
+ </div>
+ <div class="col-md-6">
+ <p><b>Total Marks:</b> {{ paper.question_paper.total_marks }}</p>
+ <p><b>Marks obtained:</b> {{ paper.marks_obtained }}</p>
+ {% if paper.percent %}
+ <p><b>Percentage obtained:</b> {{paper.percent}}%</p>
+ {% endif %}
+ <p><b>Total attempts at questions:</b> {{ paper.answers.count }}</p>
+ <p>
+ <b>Attempt Number:</b>
+ <span class="badge badge-pill badge-info">
+ {{paper.attempt_number}}
+ </span>
+ <select id="attempt" onchange="window.location.href=this.value" class="custom-select">
+ <option selected="">Select attempt number</option>
+ {% for attempt in attempts %}
+ <option value="{% url 'yaksh:grade_user' quiz_id user_id attempt.attempt_number course_id %}">
+ {{attempt.attempt_number}}
+ </option>
+ {% endfor %}
+ </select>
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <hr>
+ {% if paper.answers.count %}
+ <div class="card">
+ <div class="card-header">
+ Submission Details
+ </div>
+ <div class="card-body">
+ <table class="tablesorter table table-striped table-bordered table-responsive-sm" id='marks_table'>
+ <thead>
+ <tr>
+ <th>Questions</th>
+ <th>Type</th>
+ <th>Marks Obtained</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for question, answers in paper.get_question_answers.items %}
+ {% with answers|last as answer %}
+ <tr>
+ <td>
+ <a href="#question_{{question.id}}">
+ {{ question.summary }}
+ </a>
+ </td>
+ <td>{{ question.type }}</td>
+ <td>{{ answer.answer.marks }}</td>
+ </tr>
+ {% endwith %}
+ {% endfor %}
+ </tbody>
+ </table>
+ <form name=frm id="q{{ paper.quiz.id }}_form"
+ action="{% url 'yaksh:grade_user' quiz_id user_id paper.attempt_number course_id %}"
+ method="post">
+ {% csrf_token %}
+ {% for question, answers in paper.get_question_answers.items %}
+ <div class="card" id="question_{{question.id}}">
+ <div class="card-header text-white bg-info">
+ <strong>
+ Details: {{forloop.counter}}. {{ question.summary }}
+ <span class="marks pull-right"> Mark(s): {{ question.points }} </span>
+ </strong>
+ </div>
+ <div class="card-body">
+ <h5>
+ <span class="badge badge-pill badge-primary">Question:</span>
+ </h5>
+ <strong>{{ question.description }}</strong>
+ <br><br>
+ {% if question.type == "mcq" or question.type == "mcc" %}
+ <h5>
+ <span class="badge badge-pill badge-primary">Choices:</span>
+ </h5>
+ {% for testcase in question.get_test_cases %}
+ {% if testcase.correct %}
+ <strong>
+ <span class="badge badge-pill badge-success">
+ {{ forloop.counter }}.
+ </span>
+ {{ testcase.options|safe }}
+ </strong>
+ {% else %}
+ <strong>
+ <span class="badge badge-pill badge-secondary">
+ {{ forloop.counter }}.
+ </span>
+ {{ testcase.options|safe }}
+ </strong>
+ {% endif %}
+ <br>
+ {% endfor %}
+ {% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
+ <h5>
+ <span class="badge badge-pill badge-primary">
+ Correct Answer:
+ </span>
+ </h5>
+ {% for testcase in question.get_test_cases %}
+ <strong>{{ testcase.correct }}</strong>
+ {% if testcase.error_margin %}
+ <strong>{{ testcase.error_margin }}</strong>
+ {% endif %}
+ {% endfor %}
+ {% elif question.type == "arrange" %}
+ <h5>
+ <span class="badge badge-pill badge-primary">
+ Correct Order:</span>
+ </h5>
+ <div class="list-group" >
+ {% for testcase in question.get_test_cases %}
+ <li class="list-group-item">
+ <strong>{{ testcase.options }}</strong>
+ </li>
+ {% endfor %}
+ </div>
+ {% else %}
+ <h5>
+ <span class="badge badge-pill badge-primary">Test cases:
+ </span>
+ </h5>
+ {% for testcase in question.get_test_cases %}
+ <strong>
+ {{ forloop.counter }}. {{ testcase }}
+ </strong>
+ <br>
+ {% endfor %}
+ {% endif %}
+ <br>
+ <h5>
+ <span class="badge badge-pill badge-primary">Student answer(s):
+ </span>
+ </h5>
+ {% if question.type == "upload" %}
+ {% if has_user_assignments %}
+ <a href="{% url 'yaksh:download_user_assignment' question.id data.user.id paper.question_paper.quiz.id course_id %}">
+ <div class="btn btn-outline-info text-center">
+ Assignment File for {{ data.user.get_full_name.title }}
+ </div>
+ </a>
+ {% else %}
+ <center>
+ <div class="alert alert-warning">
+ <h5>
+ Assignment not submitted by {{ data.user.get_full_name.title }}
+ </h5>
+ </div>
+ </center>
+ {% endif %} <!-- End has_user_assignments -->
+ {% else %}
+ {% for ans in answers %}
+ <strong>
+ Attempt Number: {{forloop.counter}}
+ </strong>
+ <div id="accordian">
+ <div class="card">
+ {% if ans.answer.correct %}
+ <div class="card-header">
+ <span class="badge badge-success">
+ Correct answer:
+ </span>
+ <a class="card-link" data-toggle="collapse" href="#submitted_{{ans.answer.id}}">
+ <span class="pull-right">
+ Details&nbsp;<i class="fa fa-toggle-down"></i>
+ </span>
+ </a>
+ </div>
+ {% else %}
+ <div class="card-header">
+ <span class="badge badge-danger">
+ Error:
+ </span>
+ <a class="card-link" data-toggle="collapse" href="#submitted_{{ans.answer.id}}">
+ <span class="pull-right">
+ Details&nbsp;<i class="fa fa-toggle-down"></i>
+ </span>
+ </a>
+ </div>
+ {% endif %}
+ <div class="collapse hide" id="submitted_{{ans.answer.id}}" data-parent="#accordion">
+ <div class="card-body">
+ {% with ans.error_list as err %}
+ {% for error in err %}
+ {% if error.type == 'stdio' %}
+ {% if error.given_input %}
+ <table class="table table-bordered table-responsive-sm">
+ <tr class="table-active">
+ <td> For given Input value(s):</td>
+ <td>{{error.given_input}}</td>
+ </tr>
+ </table>
+ {% endif %}
+ <table id="course-detail" class="table table-bordered table-responsive-sm" width="100%" id="output">
+ <tr>
+ <th><center>Line No.</center></th>
+ <th><center>Expected Output</center></th>
+ <th><center>User output</center></th>
+ <th><center>Status</center></th>
+ </tr>
+ {% for expected,user in error.expected_output|zip:error.user_output %}
+ <td> {{forloop.counter}} </td>
+ <td>{{expected|default:""}} </td>
+ <td>{{user|default:""}}</td>
+ {% if forloop.counter0 in error.error_line_numbers or not expected or not user %}
+ <td><span class ="fa fa-times text-warning"/></td>
+ {% else %}
+ <td><span class ="fa fa-check text-success"/></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+ <table width="100%" class="table table-bordered table-responsive-sm">
+ <col width="10">
+ <tr>
+ <td>Error:</td>
+ <td>{{error.error_msg}}</td>
+ </tr>
+ </table>
+ {% elif error.type == 'assertion' %}
+ {% if error.test_case %}
+ <strong>
+ We tried you code with the following test case:
+ </strong><br><br>
+ <pre><code>
+ <strong>{{error.test_case}}</strong>
+ </code></pre>
+ {% endif %}
+ <p><b>The following error took place: </b></p>
+ <table id="course-detail" class="table table-bordered table-responsive-sm" width="100%">
+ <tr class = "active">
+ <td><b>Exception Name: </b></td>
+ <td><span>{{error.exception}}</span></td>
+ </tr>
+ <tr>
+ <td><b>Exception Message: </b></td><td>{{error.message}}</td>
+ </tr>
+ <tr>
+ {% if error.traceback %}
+ <td><b>Full Traceback: </b></td>
+ <td><pre>{{error.traceback}}</pre></td>
+ {% endif %}
+ </tr>
+ </table>
+ {% else %}
+ <pre><code> {{error}} </code></pre>
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ {% if question.type == "code" %}
+ <pre><code>{{ ans.answer.answer.strip }}</code></pre>
+ {% elif question.type == "mcc" or question.type == "mcq" %}
+ {% for testcases in question.get_test_cases %}
+ {% if testcases.id|stringformat:"i" in ans.answer.answer.strip %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
+ {% endfor %}
+ {% elif question.type == "arrange"%}
+ {% get_answer_for_arrange_options ans.answer.answer question as tc_list %}
+ {% for testcases in tc_list %}
+ <li>{{ testcases.options.strip }}</li>
+ {% endfor %}
+ {% else %}
+ {{ ans.answer.answer.strip }}
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ </div>
+ <br>
+ {% endfor %} <!-- End for ans in answers -->
+ </div>
+ </div>
+ {% endif %}
+ <br>
+ <div class="form-group">
+ <div class="col-md-2">
+ <label class="col-form-label" for="q{{ question.id }}">Marks:</label>
+ {% with answers|last as answer %}
+ <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answer.answer.marks }}"><br><br>
+ {% endwith %}
+ </div>
+ </div>
+ <hr/>
+ {% endfor %} {# for question, answers ... #}
+ <div class="form-group">
+ <h3>Teacher comments: </h3>
+ <textarea id="comments_{{paper.question_paper.id}}" class="form-control"
+ name="comments_{{ paper.question_paper.id }}">{{ paper.comments }}</textarea>
+ <br>
+ <button class="btn btn-success btn-lg" type="submit" name="submit_{{paper.quiz.id}}">
+ <i class="fa fa-save"></i>&nbsp;Save
+ </button>
+ </div>
+ </form>
+ </div>
+ </div>
+ {% endif %} {# if paper.answers.count #}
+ {% endfor %} {# for paper in data.papers #}
+ {% endif %} {# if data.papers #}
+ {% else %}
+ <!-- No Data -->
+ {% endif %} {#if data#}
</div>
-{% endif %} {#if data#}
-
-</div>
+ </div>
</div>
{% endblock%}
diff --git a/yaksh/templates/yaksh/lessons.html b/yaksh/templates/yaksh/lessons.html
new file mode 100644
index 0000000..6bdc762
--- /dev/null
+++ b/yaksh/templates/yaksh/lessons.html
@@ -0,0 +1,90 @@
+{% extends "manage.html" %}
+{% load static %}
+{% block title %} My Lessons {% endblock %}
+{% block content %}
+<div class="container">
+ <div class="row">
+ <div class="col-md-8">
+ <ul class="nav nav-pills" id="course_tabs">
+ <li class="nav-item">
+ <a class="nav-link {% if created %}active{% endif %}" href="{% url 'yaksh:courses' %}">
+ My Courses
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link {% if allotted %}active{% endif %}" href="{% url 'yaksh:allotted_courses' %}">
+ Allotted Courses
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="{% url 'yaksh:add_course' %}">
+ Add New Course
+ </a>
+ </li>
+ <li class="nav-item dropdown hide">
+ <a class="nav-link dropdown-toggle active" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">More</a>
+ <div class="dropdown-menu hide" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 37px, 0px); top: 0px; left: 0px; will-change: transform;">
+ <a class="dropdown-item" href="{% url 'yaksh:show_all_quizzes' %}">
+ Add/View Quizzes
+ </a>
+ <a class="dropdown-item active" href="{% url 'yaksh:show_all_lessons' %}">
+ Add/View Lessons
+ </a>
+ <a class="dropdown-item" href="{% url 'yaksh:show_all_modules' %}">
+ Add/View Modules
+ </a>
+ <a href="{% url 'grades:grading_systems'%}" class="dropdown-item" >
+ Add/View Grading Systems
+ </a>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </div>
+</div>
+<br>
+<div class="container">
+ <a href="{% url 'yaksh:edit_lesson' %}" class="btn btn-primary btn-lg">
+ <i class="fa fa-plus-circle"></i>&nbsp;Add new Lesson
+ </a>
+ {% if not lessons %}
+ <br><br>
+ <center><h4> No new Lessons added</h4></center>
+ <br><br>
+ {% else %}
+ <center><h3> Lessons </h3></center>
+ <table id="course-details" class="table table-bordered table-responsive-sm">
+ <tr>
+ <th>Sr.No</th>
+ <th>Lesson</th>
+ </tr>
+
+ {% for lesson in lessons %}
+ <tr>
+ <td width="2%">{{forloop.counter}}</td>
+ <td width="30%">
+ <div class="row">
+ <div class="col-md-8">
+ <a href="{% url 'yaksh:edit_lesson' lesson.id %}">
+ {{ lesson.name }}
+ </a>
+ </div>
+ <div class="col-md-4">
+ {% if lesson.active %}
+ <span class="badge badge-success badge-pill">
+ Active
+ </span>
+ {% else %}
+ <span class="badge badge-danger badge-pill">
+ Closed
+ </span>
+ {% endif %}
+ </div>
+ </div>
+ </td>
+ {% endfor %} <!-- end for lessons -->
+ </tr>
+ </table>
+ {% endif %}
+</div>
+{% endblock %} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/login.html b/yaksh/templates/yaksh/login.html
index e2adca7..63a2ef2 100644
--- a/yaksh/templates/yaksh/login.html
+++ b/yaksh/templates/yaksh/login.html
@@ -52,9 +52,11 @@
</table>
</center>
<div class="row justify-content-center">
- <button class="btn btn-lg btn-success btn-block" type="submit" id="login-btn">Login</button>
+ <button class="btn btn-lg btn-success btn-block" type="submit" id="login-btn">
+ <i class="fa fa-sign-in"></i>&nbsp;Login
+ </button>
<a href="{% url 'yaksh:register' %}" class="btn btn-lg btn-primary btn-block" id="signup-btn">
- NEW USER? SIGN UP
+ <i class="fa fa-user-plus"></i>&nbsp;NEW USER? SIGN UP
</a>
<a class="btn btn-lg btn-primary btn-block" href="{% url 'password_reset' %}" id="forgot-btn">
Forgot Password?
diff --git a/yaksh/templates/yaksh/moderator_dashboard.html b/yaksh/templates/yaksh/moderator_dashboard.html
index af1f546..5d0de7b 100644
--- a/yaksh/templates/yaksh/moderator_dashboard.html
+++ b/yaksh/templates/yaksh/moderator_dashboard.html
@@ -116,11 +116,6 @@
<br>
{% endif %}
{% endwith %}
- {% if trial_paper %}
- {% for paper in trial_paper %}
- <a href="{% url 'yaksh:grade_user' paper.question_paper.quiz.id paper.course.id %}">{{paper.question_paper.quiz.description}}</a>
- {% endfor %}
- {% endif %}
</div>
{% endblock %}
diff --git a/yaksh/templates/yaksh/modules.html b/yaksh/templates/yaksh/modules.html
new file mode 100644
index 0000000..4edbf7d
--- /dev/null
+++ b/yaksh/templates/yaksh/modules.html
@@ -0,0 +1,117 @@
+{% extends "manage.html" %}
+{% load static %}
+
+{% block title %} My Modules {% endblock %}
+{% block content %}
+<div class="container">
+ <div class="row">
+ <div class="col-md-8">
+ <ul class="nav nav-pills" id="course_tabs">
+ <li class="nav-item">
+ <a class="nav-link {% if created %}active{% endif %}" href="{% url 'yaksh:courses' %}">
+ My Courses
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link {% if allotted %}active{% endif %}" href="{% url 'yaksh:allotted_courses' %}">
+ Allotted Courses
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="{% url 'yaksh:add_course' %}">
+ Add New Course
+ </a>
+ </li>
+ <li class="nav-item dropdown hide">
+ <a class="nav-link dropdown-toggle active" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">More</a>
+ <div class="dropdown-menu hide" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 37px, 0px); top: 0px; left: 0px; will-change: transform;">
+ <a class="dropdown-item" href="{% url 'yaksh:show_all_quizzes' %}">
+ Add/View Quizzes
+ </a>
+ <a class="dropdown-item" href="{% url 'yaksh:show_all_lessons' %}">
+ Add/View Lessons
+ </a>
+ <a class="dropdown-item active" href="{% url 'yaksh:show_all_modules' %}">
+ Add/View Modules
+ </a>
+ <a href="{% url 'grades:grading_systems'%}" class="dropdown-item" >
+ Add/View Grading Systems
+ </a>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </div>
+</div>
+<br>
+<div class="container">
+ <a href="{% url 'yaksh:add_module' %}" class="btn btn-primary btn-lg">
+ <i class="fa fa-plus-circle"></i>&nbsp;Add new Module
+ </a>
+ {% if not modules %}
+ <center><h4> No new learning modules added</h4></center>
+ <br><br>
+ {% else %}
+ <center><h3> Learning Modules </h3></center>
+ <table class="table table-bordered table-responsive-sm">
+ <tr>
+ <th>Sr.No</th>
+ <th>Learning Modules</th>
+ <th>Design Module</th>
+ <th>Lessons/Quizzes</th>
+ </tr>
+ {% for module in modules %}
+ <tr>
+ <td width="2%">{{forloop.counter}}</td>
+ <td width="30%">
+ <div class="row">
+ <div class="col-md-7">
+ <a href="{% url 'yaksh:edit_module' module.id %}">
+ {{ module.name }}
+ </a>
+ </div>
+ <div class="col-md-4">
+ {% if module.active %}
+ <span class="badge badge-success badge-pill">
+ Active
+ </span>
+ {% else %}
+ <span class="badge badge-danger badge-pill">
+ Closed
+ </span>
+ {% endif %}
+ </div>
+ </div>
+ </td>
+ <td width="40%">
+ <a href="{% url 'yaksh:design_module' module.id %}">
+ Add Quizzes/Lessons for {{module.name}}
+ </a>
+ </td>
+ <td width="30%">
+ {% with module.get_learning_units as units %}
+ {% if units %}
+ <ul class="list-group">
+ {% for unit in units %}
+ <li class="list-group-item">
+ {% if unit.type == 'quiz' %}
+ {{unit.quiz.description}}
+ {% else %}
+ {{unit.lesson.name}}
+ {% endif %}
+ </li>
+ {% endfor %} <!-- end for learning units -->
+ </ul>
+ {% else %}
+ <span class="badge badge-danger badge-pill">
+ No Learning units
+ </span>
+ {% endif %}
+ {% endwith %}
+ </td>
+ {% endfor %} <!-- end for modules -->
+ </tr>
+ </table>
+ {% endif %}
+</div>
+{% endblock %} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/monitor.html b/yaksh/templates/yaksh/monitor.html
index a9f8328..51ca73e 100644
--- a/yaksh/templates/yaksh/monitor.html
+++ b/yaksh/templates/yaksh/monitor.html
@@ -1,14 +1,15 @@
{% extends "manage.html" %}
{% load custom_filters %}
+{% load static %}
{% block title %} Monitor {% endblock %}
{% block pagetitle %} {{ msg }} {% endblock pagetitle %}
{% block meta %} <meta http-equiv="refresh" content="30"/> {% endblock meta %}
-
{% block script %}
{% if papers %}
-<script src="{{ URL_ROOT }}/static/yaksh/js/jquery.tablesorter.min.js"></script>
+<script type="text/javascript" src="{% static 'yaksh/js/jquery.tablesorter.min.js' %}">
+</script>
<script type="text/javascript">
$(document).ready(function()
{
@@ -29,166 +30,195 @@ $(document).ready(function()
{% block content %}
<div class="container">
- <div class="yakshwell">
- {# ############################################################### #}
- {# This is rendered when we are just viewing exam/monitor #}
-
- {% if course_details %}
- <div class="table-wrapper-2">
- <table id="course-details" class="table table-bordered table-responsive-sm">
- <tr class="table-info">
- <th>Courses</th>
- <th> Quizzes </th>
- </tr>
-
- {% for course in course_details %}
- <tr>
- <td><ul class="list-group">{{course.name}} </td>
-
- {% if course.get_quizzes %}
- <td>
- {% for quiz in course.get_quizzes %}
- <li class="list-group-item"><a href = "{{URL_ROOT}}/exam/manage/monitor/{{quiz.id}}/{{course.id}}/">
- {{quiz.description}}
- </a></li>
- {% endfor %}
- </td>
- {% else %}
- <td> No quiz</td>
- {% endif %}
- </ul></tr>
- {% endfor %}
- </table>
- </div>
- {% endif %}
+ {# ############################################################### #}
+ {# This is rendered when we are just viewing exam/monitor #}
+ {% if objects %}
+ {% include "yaksh/paginator.html" %}
+ <div id="accordion">
+ {% for course in objects %}
+ <div class="card">
+ <div class="card-header">
+ <div class="row">
+ <div class="col-md-9">
+ <h5 data-toggle="tooltip" title="{{course.name}}">
+ {{ course.name }}
+ </h5>
+ </div>
+ <div class="col-md">
+ <a class="card-link btn btn-info" data-toggle="collapse" href="#collapse{{course.id}}">
+ Details
+ <i class="fa fa-toggle-down" id="toggle_course_{{course.id}}"></i>
+ </a>
+ </div>
+ </div>
+ </div>
+ <div id="collapse{{course.id}}" class="collapse hide" data-parent="#accordion">
+ <div class="card-body">
+ {% with course.get_quizzes as quizzes %}
+ {% if quizzes %}
+ <ul class="list-group">
+ {% for quiz in quizzes %}
+ <li class="list-group-item">
+ <div class="row">
+ <div class="col-md-8">
+ {{quiz.description}}
+ </div>
+ <div class="col-md-2">
+ <a href="{% url 'yaksh:monitor' quiz.id course.id%}" class="btn btn-primary">
+ Monitor
+ </a>
+ </div>
+ </div>
+ </li>
+ {% endfor %}
+ </ul>
+ {% else %}
+ <center>
+ <p class="badge badge-danger badge-pill">
+ No Quizzes
+ </p>
+ </center>
+ {% endif %}
+ {% endwith %}
+ </div>
+ </div>
+ </div>
+ <br>
+ {% endfor %}
+ </div>
+ {% include "yaksh/paginator.html" %}
+ {% endif %}
- {# ############################################################### #}
- {# This is rendered when we are just viewing exam/monitor/quiz_num #}
- {% if msg != "Monitor" %}
- {% if quiz %}
+ {# ############################################################### #}
+ {# This is rendered when we are just viewing exam/monitor/quiz_num #}
+ {% if msg != "Monitor" %}
+ {% if quiz %}
{% if papers %}
- <div class="row">
- <div class="card col-md-10">
- <div class = "table-responsive"">
- <table class = "table">
- <tr>
- <td><b>Course Name:&nbsp</b></td>
- <td>{{course.name}}</td>
- </tr>
- <tr>
- <td><b>Quiz Name:&nbsp</b></td>
- <td>{{quiz.description}}</td>
- </tr>
- <tr>
- <td><b>Number of papers: &nbsp</b></td>
- <td>{{papers|length}}</td>
- </tr>
- <tr>
- <td><b>Papers Completed: &nbsp</b></td>
- <td>
- {% completed papers as completed_papers %}
- <b class = "yakshgreen">{{completed_papers}}</b>
- </td>
- </tr>
- <tr>
- <td><b>Papers in progress: &nbsp</b></td>
- <td>
- {% inprogress papers as inprogress_papers %}
- <b class="yakshred"> {{ inprogress_papers }} </b>
- </td>
- </tr>
- </table>
+ <div class="card">
+ <div class="table-responsive">
+ <table id="course-detail" class="table">
+ <tr>
+ <td><b>Course Name:&nbsp</b></td>
+ <td>{{course.name}}</td>
+ </tr>
+ <tr>
+ <td><b>Quiz Name:&nbsp</b></td>
+ <td>{{quiz.description}}</td>
+ </tr>
+ <tr>
+ <td><b>Number of papers: &nbsp</b></td>
+ <td>{{papers|length}}</td>
+ </tr>
+ <tr>
+ <td><b>Papers Completed: &nbsp</b></td>
+ <td>
+ {% completed papers as completed_papers %}
+ <b>{{completed_papers}}</b>
+ </td>
+ </tr>
+ <tr>
+ <td><b>Papers in progress: &nbsp</b></td>
+ <td>
+ {% inprogress papers as inprogress_papers %}
+ <b>{{ inprogress_papers }}</b>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <br>
+ <div class="row">
+ <div class="col-md-4">
+ <a href="{% url 'yaksh:show_statistics' papers.0.question_paper.id course.id %}" class="btn btn-primary">
+ <i class="fa fa-line-chart"></i>&nbsp;Question Statistics
+ </a>
</div>
- </div>
- <div class = "row">
- <div class="col-md-2">
- <p><a href="{{URL_ROOT}}/exam/manage/statistics/question/{{papers.0.question_paper.id}}/{{course.id}}" class="btn btn-primary">Question Statisitics</a></p>
- <p>
- <button type="button" class="btn btn-info" data-toggle="modal" data-target="#csvModal">
- Download CSV <span class="fa fa-download"></span>
- </button>
- </p>
+ <div class="col-md-4">
+ <button type="button" class="btn btn-info" data-toggle="modal" data-target="#csvModal">
+ <i class="fa fa-download"></i>&nbsp;Download CSV
+ </button>
</div>
- </div>
- <div class="table-wrapper-2">
- <table id="result-table" class="tablesorter table table-striped table-responsive-sm">
- <thead>
- <tr class="table-info">
- <th> Name </th>
- <th> Username </th>
- <th> Roll number </th>
- <th> Institute </th>
- <th> Questions answered </th>
- <th> Marks obtained </th>
- <th> Attempts </th>
- <th> Time Remaining </th>
- <th> Status </th>
- </tr>
- </thead>
- <tbody>
- {% for paper in latest_attempts %}
- <tr>
- <td> <a href="{{URL_ROOT}}/exam/manage/user_data/{{paper.user.id}}/{{paper.question_paper.id}}/{{course.id}}"><i class="fa fa-circle fa-sm"></i> {{ paper.user.get_full_name.title }}</a> </td>
- <td> {{ paper.user.username }} </td>
- <td> {{ paper.user.profile.roll_number }} </td>
- <td> {{ paper.user.profile.institute }} </td>
- <td> {{ paper.get_answered_str }} </td>
- <td> {{ paper.marks_obtained }} </td>
- <td> {{ paper.answers.count }} </td>
- <td id="time_left{{forloop.counter0}}"> {{ paper.time_left }} </td>
- <td>{{ paper.status }}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- {% else %}
- <p> No answer papers found for {{ quiz.description }}</p>
- {% endif %} {# if papers #}
- {% else %}
- <h4>No Quiz Found</h4>
- {% endif %}
- {% endif %}
- </div>
- <!-- CSV Modal -->
- <div class="modal fade" id="csvModal" role="dialog">
- <div class="modal-dialog">
+ </div>
+ <br>
+ <table id="result-table" class="tablesorter table table-striped table-responsive-sm">
+ <thead>
+ <tr>
+ <th> Name&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Username&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Roll No&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Institute&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Marks&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Attempts&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Time&nbsp;<i class="fa fa-sort"></i> </th>
+ <th> Status&nbsp;<i class="fa fa-sort"></i> </th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for paper in latest_attempts %}
+ <tr>
+ <td> <a href="{% url 'yaksh:user_data' paper.user.id paper.question_paper.id course.id %}">
+ {{ paper.user.get_full_name.title }}</a> </td>
+ <td> {{ paper.user.username }} </td>
+ <td> {{ paper.user.profile.roll_number }} </td>
+ <td> {{ paper.user.profile.institute }} </td>
+ <td> {{ paper.marks_obtained }} </td>
+ <td> {{ paper.answers.count }} </td>
+ <td id="time_left{{forloop.counter0}}"> {{ paper.time_left }} </td>
+ <td>{{ paper.status }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ <!-- CSV Modal -->
+ <div class="modal fade" id="csvModal" role="dialog">
+ <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">&times;</button>
- <h3 class="modal-title">Uncheck unwanted columns</h3>
- </div>
- <form action="{{URL_ROOT}}/exam/manage/download_quiz_csv/{{ course.id }}/{{ quiz.id }}/" method="post">
- {% csrf_token %}
- <div class="modal-body">
- {% for field in csv_fields %}
- <div class="form-check form-check-inline">
- <label class="form-check-label">
- <input class="form-check-input" name="csv_fields" type="checkbox" value="{{ field }}" checked> {{ field }}
- </label>
- </div>
- {% endfor %}
- <b>Select Attempt Number: Default latest attempt</b>
- <select class="form-control" name = "attempt_number">
- {%for attempt_number in attempt_numbers %}
- {% if forloop.last %}
- <option value="{{ attempt_number }}" selected>{{ attempt_number }} (Latest)</option>
- {% else %}
- <option value = "{{ attempt_number }}"> {{ attempt_number }}</option>
- {% endif %}
- {% endfor %}
- </select>
- </div>
- <div class="modal-footer">
- <button type="submit" class="btn btn-primary"> Download <span class="glyphicon glyphicon-save"></span></button>
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
+ <!-- Modal content-->
+ <div class="modal-content">
+ <div class="modal-header">
+ <h3 class="modal-title">Uncheck unwanted columns</h3>
+ <button type="button" class="close" data-dismiss="modal">
+ <i class="fa fa-close"></i>
+ </button>
+ </div>
+ <form action="{% url 'yaksh:download_quiz_csv' course.id quiz.id %}" method="post">
+ {% csrf_token %}
+ <div class="modal-body">
+ {% for field in csv_fields %}
+ <div class="form-check form-check-inline">
+ <label class="form-check-label">
+ <input class="form-check-input" name="csv_fields" type="checkbox" value="{{ field }}" checked> {{ field }}
+ </label>
+ <br>
+ </div>
+ {% endfor %}
+ <b>Select Attempt Number: Default latest attempt</b>
+ <select class="form-control" name = "attempt_number">
+ {%for attempt_number in attempt_numbers %}
+ {% if forloop.last %}
+ <option value="{{ attempt_number }}" selected>{{ attempt_number }} (Latest)</option>
+ {% else %}
+ <option value = "{{ attempt_number }}"> {{ attempt_number }}</option>
+ {% endif %}
+ {% endfor %}
+ </select>
+ </div>
+ <div class="modal-footer">
+ <button type="submit" class="btn btn-primary"> Download <span class="glyphicon glyphicon-save"></span></button>
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">
+ Close
+ </button>
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
+ {% else %}
+ <p> No answer papers found for {{ quiz.description }}</p>
+ {% endif %} {# if papers #}
+ {% else %}
+ <h4>No Quiz Found</h4>
+ {% endif %}
+ {% endif %}
</div>
{% endblock %}
diff --git a/yaksh/templates/yaksh/quizzes.html b/yaksh/templates/yaksh/quizzes.html
new file mode 100644
index 0000000..d42716c
--- /dev/null
+++ b/yaksh/templates/yaksh/quizzes.html
@@ -0,0 +1,126 @@
+{% extends "manage.html" %}
+{% load static %}
+
+{% block title %} My Quizzes {% endblock %}
+{% block content %}
+<div class="container">
+ <div class="row">
+ <div class="col-md-8">
+ <ul class="nav nav-pills" id="course_tabs">
+ <li class="nav-item">
+ <a class="nav-link {% if created %}active{% endif %}" href="{% url 'yaksh:courses' %}">
+ My Courses
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link {% if allotted %}active{% endif %}" href="{% url 'yaksh:allotted_courses' %}">
+ Allotted Courses
+ </a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="{% url 'yaksh:add_course' %}">
+ Add New Course
+ </a>
+ </li>
+ <li class="nav-item dropdown hide">
+ <a class="nav-link dropdown-toggle active" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="true">More</a>
+ <div class="dropdown-menu hide" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 37px, 0px); top: 0px; left: 0px; will-change: transform;">
+ <a class="dropdown-item active" href="{% url 'yaksh:show_all_quizzes' %}">
+ Add/View Quizzes
+ </a>
+ <a class="dropdown-item" href="{% url 'yaksh:show_all_lessons' %}">
+ Add/View Lessons
+ </a>
+ <a class="dropdown-item" href="{% url 'yaksh:show_all_modules' %}">
+ Add/View Modules
+ </a>
+ <a href="{% url 'grades:grading_systems'%}" class="dropdown-item" >
+ Add/View Grading Systems
+ </a>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </div>
+</div>
+<br>
+<div class="container">
+ <a href="{% url 'yaksh:add_quiz' %}" class="btn btn-primary btn-lg">
+ <i class="fa fa-plus-circle"></i>&nbsp;Add New Quiz
+ </a>
+ <a href="{% url 'yaksh:add_exercise' %}" class="btn btn-info btn-lg">
+ <i class="fa fa-plus-circle"></i>&nbsp;Add New Exercise
+ </a>
+ {% if not quizzes %}
+ <br><br>
+ <center><h4> No new Quiz added</h4></center>
+ <br><br>
+ {% else %}
+ <center><h3> Quizzes </h3></center>
+ <table class="table table-bordered table-responsive-sm">
+ <tr>
+ <th>Sr.No</th>
+ <th>Quiz/Exercise</th>
+ <th>QuestionPaper</th>
+ </tr>
+ {% for quiz in quizzes %}
+ <tr>
+ <td>{{forloop.counter}}</td>
+ <td width="30%">
+ <div class="row">
+ <div class="col-md-7">
+ {% if quiz.is_exercise %}
+ <a href="{% url 'yaksh:edit_exercise' quiz.id %}">
+ {{ quiz.description }}
+ </a>
+ {% else %}
+ <a href="{% url 'yaksh:edit_quiz' quiz.id %}">
+ {{ quiz.description }}
+ </a>
+ {% endif %}
+ </div>
+ <div class="col-md-5">
+ {% if quiz.active %}
+ <span class="badge badge-success badge-pill">
+ Active
+ </span>
+ {% else %}
+ <span class="badge badge-danger badge-pill">
+ Closed
+ </span>
+ {% endif %}
+ </div>
+ </div>
+ </td>
+ <td>
+ {% if quiz.questionpaper_set.get %}
+ <div class="row">
+ <div class="col-md-7">
+ <a href="{% url 'yaksh:designquestionpaper' quiz.id quiz.questionpaper_set.get.id %}">
+ Question Paper for {{ quiz.description }}</a>
+ </div>
+ <div class="col-md-5">
+ <a href="{% url 'yaksh:preview_questionpaper' quiz.questionpaper_set.get.id %}" class="btn btn-primary active btn-xs" target="_blank">
+ <i class="fa fa-eye"></i>&nbsp;Preview
+ </a>
+ </div>
+ </div>
+ {% else %}
+ <div class="row">
+ <div class="col-md-7">
+ <p>No Question Paper</p>
+ </div>
+ <div class="col-md-5">
+ <a href="{% url 'yaksh:designquestionpaper' quiz.id %}" class="btn btn-success">
+ <i class="fa fa-plus-circle"></i>&nbsp;Add
+ </a>
+ </div>
+ </div>
+ {% endif %}
+ </td>
+ {% endfor %} <!-- end for quizzes -->
+ </tr>
+ </table>
+ {% endif %}
+</div>
+{% endblock %} \ No newline at end of file
diff --git a/yaksh/templates/yaksh/statistics_question.html b/yaksh/templates/yaksh/statistics_question.html
index 4d737eb..58fd8db 100644
--- a/yaksh/templates/yaksh/statistics_question.html
+++ b/yaksh/templates/yaksh/statistics_question.html
@@ -3,24 +3,29 @@
{% block pagetitle %} Statistics for {{ quiz.description }}{% endblock pagetitle %}
{% block content %}
-<div class="yakshwell container">
-<div class="row">
- <div class="col-md-2">
-{% for attempt in attempts %}
- <p><a href="{{URL_ROOT}}/exam/manage/statistics/question/{{questionpaper_id}}/{{attempt}}/{{course_id}}">Attempt {{ attempt }}</a></p>
- {% endfor %}
-</div>
-<div class="col-md-9">
-{% if question_stats %}
- <p><b>Total number of participants: {{ total }}</b></p>
- <table class="table table-bordered table-responsive-sm">
- <tr class="bg-light yakshred"><th>Question</th><th>Type</th><th>Total</th><th>Answered</th></tr>
- {% for question, value in question_stats.items %}
- <tr><td>{{ question.summary }}</td><td>{{ question.type }}</td><td>{{value.1}}</td><td>{{ value.0 }} ({% widthratio value.0 value.1 100 %}%)</td></tr>
- {% endfor %}
- </table>
- {% endif %}
+<div class="container">
+ <div class="row">
+ <div class="col-md-2">
+ <ul class="list-group">
+ {% for attempt in attempts %}
+ <li class="list-group-item">
+ <a href="{% url 'yaksh:show_statistics' questionpaper_id attempt course_id %}">Attempt {{ attempt }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+ <div class="col-md-9">
+ {% if question_stats %}
+ <p><b>Total number of participants: {{ total }}</b></p>
+ <table class="table table-bordered table-responsive-sm">
+ <tr class="bg-light yakshred"><th>Question</th><th>Type</th><th>Total</th><th>Answered</th></tr>
+ {% for question, value in question_stats.items %}
+ <tr><td>{{ question.summary }}</td><td>{{ question.type }}</td><td>{{value.1}}</td><td>{{ value.0 }} ({% widthratio value.0 value.1 100 %}%)</td></tr>
+ {% endfor %}
+ </table>
+ {% endif %}
+ </div>
</div>
</div>
-</div>
{% endblock %}
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index 317cb15..2ef9655 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -1,299 +1,359 @@
{% extends "manage.html" %}
{% load custom_filters %}
+{% load static %}
+{% block title %} User Data {% endblock %}
{% block pagetitle %} Data for user {{ data.user.get_full_name.title }} {% endblock pagetitle %}
-{% block content %}
+
{% block script %}
-<script src= "{{ URL_ROOT }}/static/yaksh/js/edit_question.js"></script>
-<script src="{{ URL_ROOT }}/static/yaksh/js/mathjax/MathJax.js?config=TeX-MML-AM_CHTML"></script>
+<script type="text/javascript" src="{% static 'yaksh/js/jquery.tablesorter.min.js' %}">
+</script>
+<script type="text/javascript" src="{% static 'yaksh/js/mathjax/MathJax.js' %}?config=TeX-MML-AM_CHTML"></script>
{% endblock %}
-<div class="yakshwell container">
- <div class="card col-md-4">
- <p class="card-body">
- Name: {{ data.user.get_full_name.title }} <br/>
- Username: {{ data.user.username }} <br/>
- {% if data.profile %}
- Roll number: {{ data.profile.roll_number }} <br/>
- Position: {{ data.profile.position }} <br/>
- Department: {{ data.profile.department }} <br/>
- Institute: {{ data.profile.institute }} <br/>
- {% endif %}
- Email: {{ data.user.email }} <br/>
- Date joined: {{ data.user.date_joined }} <br/>
- Last login: {{ data.user.last_login }}
- </p>
- </div>
- {% if data.papers %}
- <p class="text-center"><a href="{{URL_ROOT}}/exam/manage/gradeuser/{{data.papers.0.question_paper.quiz.id}}/{{ data.user.id }}/{{course_id}}/" class="btn btn-info ">
+{% block content %}
+<div class="container">
+ <div class="card">
+ <div class="card-header">
+ Student Details
+ </div>
+ <div class="card-body">
+ <p><b>Name:</b> {{ data.user.get_full_name.title }}</p>
+ {% with data.profile as profile %}
+ {% if profile %}
+ <div class="row">
+ <div class="col-md-4">
+ <p><b> Roll number:</b> {{ profile.roll_number }}</p>
+ <p><b>Position: </b> {{ profile.position }}</p>
+ <p><b>Department: </b>{{ profile.department }}</p>
+ <p><b>Institute: </b>{{ profile.institute }}</p>
+ </div>
+ <div class="col-md-7">
+ <p><b>Username:</b> {{ data.user.username }}</p>
+ <p><b>Email:</b> {{ data.user.email }}</p>
+ <p><b>Date joined:</b> {{ data.user.date_joined }}</p>
+ <p><b>Last login:</b> {{ data.user.last_login }}</p>
+ </div>
+ </div>
+ {% endif %}
+ {% endwith %}
+ </div>
+ </div>
+ <hr>
+ {% if data.papers %}
+ <p class="text-center"><a href="{% url 'yaksh:grade_user' data.papers.0.question_paper.quiz.id data.user.id course_id %}" class="btn btn-info ">
Grade/correct paper</a>
- </p>
- {% for paper in data.papers %}
- {% if forloop.counter == 2 and data.questionpaperid %}
- <hr>
- <u>
- <h2> Previous attempts </h2>
- </u>
- {% endif %}
- <h2> Quiz: {{ paper.question_paper.quiz.description }} </h2>
- <p>
- Attempt Number: {{ paper.attempt_number }}<br/>
- Questions correctly answered: {{ paper.get_answered_str }} <br/>
- Total attempts at questions: {{ paper.answers.count }} <br/>
- Marks obtained: {{ paper.marks_obtained }} <br/>
- Start time: {{ paper.start_time }} <br/>
- User IP address: {{ paper.user_ip }}
- </p>
- {% if paper.answers.count %}
- <div class="table-wrapper-2">
- <h3> Answers </h3>
- <br>
- {% for question, answers in paper.get_question_answers.items %}
- <div class = "yakshlabel">
- <div class="card">
- <div class="card-heading alert-info" id="question_{{question.id}}">
- <strong> Details: {{forloop.counter}}. {{ question.summary }}
- <a href="" onClick="grade_data('show_question{{question.id}}{{paper.attempt_number}}'); return false;"> Show Question </a>
- <span class="marks pull-right"> Mark(s): {{ question.points }} </span>
+ </p>
+ {% for paper in data.papers %}
+ {% if forloop.counter == 2 and data.questionpaperid %}
+ <hr>
+ <u>
+ <h2> Previous attempts </h2>
+ </u>
+ {% endif %}
+ <div class="card">
+ <div class="card-header">
+ Course Details
+ </div>
+ <div class="card-body">
+ <div class="row">
+ <div class="col-md-6">
+ <p><b>Course:</b> {{ paper.course.name }}</p>
+ <p><b>Quiz:</b> {{ paper.question_paper.quiz.description }}</p>
+ <p><b>Start time:</b> {{ paper.start_time }}</p>
+ <p><b>End time:</b> {{ paper.end_time }}</p>
+ <p><b>Status:</b>
+ {% if paper.passed %}
+ <span class="badge badge-pill badge-success"> Passed </span>
+ {% else %}
+ <span class="badge badge-pill badge-danger"> Failed </span>
+ {% endif %}
+ </p>
+ </div>
+ <div class="col-md-6">
+ <p><b>Total Marks:</b> {{ paper.question_paper.total_marks }}</p>
+ <p><b>Marks obtained:</b> {{ paper.marks_obtained }}</p>
+ {% if paper.percent %}
+ <p><b>Percentage obtained:</b> {{paper.percent}}%</p>
+ {% endif %}
+ <p><b>Total attempts at questions:</b> {{ paper.answers.count }}</p>
+ <p>
+ <b>Attempt Number:</b>
+ <span class="badge badge-pill badge-info">
+ {{paper.attempt_number}}
+ </span>
+ </p>
+ <p><b>User IP address:</b> {{ paper.user_ip }}</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <hr>
+ {% if paper.answers.count %}
+ <div class="card">
+ <div class="card-header">
+ Submission Details
+ </div>
+ <div class="card-body">
+ <table class="tablesorter table table-striped table-bordered table-responsive-sm" id='marks_table'>
+ <thead>
+ <tr>
+ <th>Questions</th>
+ <th>Type</th>
+ <th>Marks Obtained</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for question, answers in paper.get_question_answers.items %}
+ {% with answers|last as answer %}
+ <tr>
+ <td>
+ <a href="#question_{{question.id}}">
+ {{ question.summary }}
+ </a>
+ </td>
+ <td>{{ question.type }}</td>
+ <td>{{ answer.answer.marks }}</td>
+ </tr>
+ {% endwith %}
+ {% endfor %}
+ </tbody>
+ </table>
+ {% for question, answers in paper.get_question_answers.items %}
+ <div class="card" id="question_{{question.id}}">
+ <div class="card-header text-white bg-info">
+ <strong>
+ Details: {{forloop.counter}}. {{ question.summary }}
+ <span class="marks pull-right"> Mark(s): {{ question.points }} </span>
</strong>
- </div>
- <div class="card-body" id="show_question{{question.id}}{{paper.attempt_number}}" style="display: none;">
- <h5><u>Question:</u></h5>
+ </div>
+ <div class="card-body">
+ <h5>
+ <span class="badge badge-pill badge-primary">Question:</span>
+ </h5>
<strong>{{ question.description|safe }}</strong>
+ <br><br>
{% if question.type == "mcq" or question.type == "mcc" %}
- <h5> <u>Choices:</u></h5>
- {% for testcase in question.get_test_cases %}
- {% if testcase.correct %}
- <br/>
- <strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong>
- <span class="badge badge-success">Correct </span>
- {% else %}
- <br/><strong>
- {{ forloop.counter }}. {{ testcase.options|safe }}</strong>
- {% endif %}
- {% endfor %}
+ <h5>
+ <span class="badge badge-pill badge-primary">Choices:</span>
+ </h5>
+ {% for testcase in question.get_test_cases %}
+ {% if testcase.correct %}
+ <strong>
+ <span class="badge badge-pill badge-success">
+ {{ forloop.counter }}.
+ </span>
+ {{ testcase.options|safe }}
+ </strong>
+ {% else %}
+ <strong>
+ <span class="badge badge-pill badge-secondary">
+ {{ forloop.counter }}.
+ </span>
+ {{ testcase.options|safe }}
+ </strong>
+ {% endif %}
+ <br>
+ {% endfor %}
{% elif question.type == "integer" or question.type == "string" or question.type == "float" %}
- <h5> <u>Correct Answer:</u></h5>
- {% for testcase in question.get_test_cases %}
- <strong>{{ testcase.correct|safe }}</strong>
- {% if testcase.error_margin %}
- <strong>{{ testcase.error_margin|safe }}</strong>
- {% endif %}
- {% endfor %}
+ <h5>
+ <span class="badge badge-pill badge-primary">
+ Correct Answer:
+ </span>
+ </h5>
+ {% for testcase in question.get_test_cases %}
+ <strong>{{ testcase.correct }}</strong>
+ {% if testcase.error_margin %}
+ <strong>{{ testcase.error_margin }}</strong>
+ {% endif %}
+ {% endfor %}
{% elif question.type == "arrange" %}
- <h5> <u>Correct Order:</u></h5>
- <div class="list-group" >
- {% for testcase in question.get_test_cases %}
- <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li>
- {% endfor %}
- </div>
+ <h5>
+ <span class="badge badge-pill badge-primary">
+ Correct Order:</span>
+ </h5>
+ <div class="list-group" >
+ {% for testcase in question.get_test_cases %}
+ <li class="list-group-item">
+ <strong>{{ testcase.options }}</strong>
+ </li>
+ {% endfor %}
+ </div>
{% else %}
- <h5> <u>Test cases: </u></h5>
- {% for testcase in question.get_test_cases %}
- <br/><strong>{{ forloop.counter }}. {{ testcase }}</strong>
- {% endfor %}
- {%endif%}
- </div>
- </div>
- <h5>Student answer: </h5>
- {% if question.type == "upload" %}
- {% if has_user_assignments %}
- <a href="{{URL_ROOT}}/exam/manage/download/user_assignment/{{question.id}}/{{data.user.id}}/{{paper.question_paper.quiz.id}}/{{course_id}}">
- <div class="btn btn-outline-info text-center">
- Assignment File for {{ data.user.get_full_name.title }}
- </div>
- </a>
- {% with answers|last as answer%}
- {% if answer.answer.correct %}
- <div class="card ">
- <div class="card-heading alert-success">Correct answer</div>
- </div>
- {% else %}
- <div class="card ">
- <div class="card-heading alert-danger">Incorrect Answer</div>
- </div>
- {% endif %}
- {% endwith %}
- {% else %}
- <center>
- <div class="alert alert-warning animated flash">
- <h5>No Assignment submitted by {{ data.user.get_full_name.title }}</h5>
- </div>
- </center>
- {% endif %}
- {% else %}
- {% for ans in answers %}
- {% if ans.answer.correct %}
- <div class="card ">
- <div class="card-heading alert-success">
- Correct answer:
+ <h5>
+ <span class="badge badge-pill badge-primary">Test cases:
+ </span>
+ </h5>
+ {% for testcase in question.get_test_cases %}
+ <strong>
+ {{ forloop.counter }}. {{ testcase }}
+ </strong>
+ <br>
+ {% endfor %}
+ {% endif %}
+ <br>
+ <h5>
+ <span class="badge badge-pill badge-primary">Student answer(s):
+ </span>
+ </h5>
+ {% if question.type == "upload" %}
+ {% if has_user_assignments %}
+ <a href="{% url 'yaksh:download_user_assignment' question.id data.user.id paper.question_paper.quiz.id course_id %}">
+ <div class="btn btn-outline-info text-center">
+ Assignment File for {{ data.user.get_full_name.title }}
+ </div>
+ </a>
+ {% else %}
+ <center>
+ <div class="alert alert-warning">
+ <h5>
+ Assignment not submitted by {{ data.user.get_full_name.title }}
+ </h5>
+ </div>
+ </center>
+ {% endif %} <!-- End has_user_assignments -->
{% else %}
- <div class="card ">
- <div class="card-heading-heading alert-danger">
- Error:
+ {% for ans in answers %}
+ <strong>
+ Attempt Number: {{forloop.counter}}
+ </strong>
+ <div id="accordian">
+ <div class="card">
+ {% if ans.answer.correct %}
+ <div class="card-header">
+ <span class="badge badge-success">
+ Correct answer:
+ </span>
+ <a class="card-link" data-toggle="collapse" href="#submitted_{{ans.answer.id}}">
+ <span class="pull-right">
+ Details&nbsp;<i class="fa fa-toggle-down"></i>
+ </span>
+ </a>
+ </div>
+ {% else %}
+ <div class="card-header">
+ <span class="badge badge-danger">
+ Error:
+ </span>
+ <a class="card-link" data-toggle="collapse" href="#submitted_{{ans.answer.id}}">
+ <span class="pull-right">
+ Details&nbsp;<i class="fa fa-toggle-down"></i>
+ </span>
+ </a>
+ </div>
{% endif %}
- {% with ans.error_list as err %}
- {% for error in err %}
- {% if error.type == 'stdio' %}
- <div class = "card">
- <div class="card-body">
- {% if error.given_input %}
- <table class="table table-bordered table-responsive-sm">
- <col width="30%">
- <tr class = "table-active">
- <td> For given Input value(s):</td>
- <td>{{error.given_input}}</td>
- </tr>
- </table>
- {% endif %}
- <table class="table table-bordered table-responsive-sm" width="100%" id="output" style="table-layout: fixed">
- <col width="10%">
- <col width="40%">
- <col width="40%">
- <col width="10%">
- <tr>
- <th>
- <center>Line No.</center>
- </th>
- <th>
- <center>Expected Output</center>
- </th>
- <th>
- <center>User output</center>
- </th>
- <th>
- <center>Status</center>
- </th>
- </tr>
- {% for expected,user in error.expected_output|zip:error.user_output %}
- <tr>
+ <div class="collapse hide" id="submitted_{{ans.answer.id}}" data-parent="#accordion">
+ <div class="card-body">
+ {% with ans.error_list as err %}
+ {% for error in err %}
+ {% if error.type == 'stdio' %}
+ {% if error.given_input %}
+ <table class="table table-bordered table-responsive-sm">
+ <tr class="table-active">
+ <td> For given Input value(s):</td>
+ <td>{{error.given_input}}</td>
+ </tr>
+ </table>
+ {% endif %}
+ <table id="course-detail" class="table table-bordered table-responsive-sm" width="100%" id="output">
+ <tr>
+ <th><center>Line No.</center></th>
+ <th><center>Expected Output</center></th>
+ <th><center>User output</center></th>
+ <th><center>Status</center></th>
+ </tr>
+ {% for expected,user in error.expected_output|zip:error.user_output %}
<td> {{forloop.counter}} </td>
<td>{{expected|default:""}} </td>
<td>{{user|default:""}}</td>
{% if forloop.counter0 in error.error_line_numbers or not expected or not user %}
- <td><span class ="fa fa-times text-warning"></span></td>
+ <td><span class ="fa fa-times text-warning"/></td>
{% else %}
- <td><span class ="fa fa-check text-success"></span></td>
+ <td><span class ="fa fa-check text-success"/></td>
{% endif %}
- </tr>
- {% endfor %}
- </table>
- <table width="100%" class="table table-bordered table-responsive-sm">
- <col width="10">
- <tr>
- <td><b>Error:</b></td>
- <td>{{error.error_msg}}</td>
- </tr>
- </table>
- </div>
- </div>
- {% elif error.type == 'assertion' %}
- {% if error.test_case %}
- <strong> We tried you code with the following test case:</strong><br/></br>
- <pre><code><strong style="color:#d9534f">{{error.test_case}}</strong></code></pre>
- {% endif %}
- <p> <b>The following error took place: </b></p>
- <div class="card">
- <div class="card-body">
- <table class="table table-bordered table-responsive-sm" width="100%" style="table-layout: fixed">
- <col width="30%">
- <tr class = "active">
- <td><b>Exception Name: </b></td>
- <td><span style="color: #d9534f">{{error.exception}}</span></td>
- </tr>
- <tr>
- <td><b>Exception Message: </b></td>
- <td>{{error.message}}</td>
- </tr>
- <tr>
- {% if error.traceback %}
- <td><b>Full Traceback: </b></td>
- <td>
- <pre>{{error.traceback}}</pre>
- </td>
- {% endif %}
- </tr>
- </table>
- </div>
- </div>
- <!-- Closes card -->
- {% else %}
- <pre><code> {{error|safe}} </code></pre>
- {% endif %}
- {% endfor %}
- {% endwith %}
- </div>
- <div class="card-body">
- {% if question.type == "code" %}
- <pre><code>{{ ans.answer.answer.strip|safe }}</code></pre>
- {% elif question.type == "mcc"%}
- <div class="card">
- <div class="card-body">
- {% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" in ans.answer.answer.strip|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
- {% endif %}
+ </tr>
+ {% endfor %}
+ </table>
+ <table width="100%" class="table table-bordered table-responsive-sm">
+ <col width="10">
+ <tr>
+ <td>Error:</td>
+ <td>{{error.error_msg}}</td>
+ </tr>
+ </table>
+ {% elif error.type == 'assertion' %}
+ {% if error.test_case %}
+ <strong>
+ We tried you code with the following test case:
+ </strong><br><br>
+ <pre><code>
+ <strong>{{error.test_case}}</strong>
+ </code></pre>
+ {% endif %}
+ <p><b>The following error took place: </b></p>
+ <table id="course-detail" class="table table-bordered table-responsive-sm" width="100%">
+ <tr class = "active">
+ <td><b>Exception Name: </b></td>
+ <td><span>{{error.exception}}</span></td>
+ </tr>
+ <tr>
+ <td><b>Exception Message: </b></td><td>{{error.message}}</td>
+ </tr>
+ <tr>
+ {% if error.traceback %}
+ <td><b>Full Traceback: </b></td>
+ <td><pre>{{error.traceback}}</pre></td>
+ {% endif %}
+ </tr>
+ </table>
+ {% else %}
+ <pre><code> {{error}} </code></pre>
+ {% endif %}
{% endfor %}
- </div>
- </div>
- {% elif question.type == "mcq"%}
- <div class="card">
- <div class="card-body">
+ {% endwith %}
+ {% if question.type == "code" %}
+ <pre><code>{{ ans.answer.answer.strip }}</code></pre>
+ {% elif question.type == "mcc" or question.type == "mcq" %}
{% for testcases in question.get_test_cases %}
- {%if testcases.id|stringformat:"i" == ans.answer.answer.strip|safe %}
- <li>{{ testcases.options.strip|safe }}</li>
- {% endif %}
+ {% if testcases.id|stringformat:"i" in ans.answer.answer.strip %}
+ <li>{{ testcases.options.strip|safe }}</li>
+ {% endif %}
{% endfor %}
- </div>
- </div>
- {% elif question.type == "arrange"%}
- <div class="card">
- <div class="card-body">
+ {% elif question.type == "arrange"%}
{% get_answer_for_arrange_options ans.answer.answer question as tc_list %}
{% for testcases in tc_list %}
- <li>{{ testcases.options.strip|safe }}</li>
+ <li>{{ testcases.options.strip }}</li>
{% endfor %}
- </div>
+ {% else %}
+ {{ ans.answer.answer.strip }}
+ {% endif %}
+ </div>
</div>
- {% else %}
- <div class="card">
- <div class="card-body">
- {{ ans.answer.answer.strip|safe }}
- </div>
- </div>
- {% endif %}
- </div>
- </div>
- {% endfor %}
- {% endif %}
+ </div>
+ </div>
+ <br>
+ {% endfor %} <!-- End for ans in answers -->
+ </div>
+ </div>
+ {% endif %}
+ <br>
+ <div class="form-group">
+ <div class="col-md-2">
+ <label class="col-form-label" for="q{{ question.id }}">Marks:</label>
{% with answers|last as answer %}
- Marks: <input id="q{{ question.id }}" type="text"
- name="q{{ question.id }}_marks" size="4"
- value="{{ answer.answer.marks }}"><br><br>
+ <input id="q{{ question.id }}" type="text" name="q{{ question.id }}_marks" size="4" class="form-control" value="{{ answer.answer.marks }}"><br><br>
{% endwith %}
- <hr/>
- </div>
-
- {% endfor %} {# for question, answers ... #}
- </div>
-
-
-<h3>Teacher comments: </h3>
-{{ paper.comments|default:"None" }}
-{% endif %} {# if paper.answers.count #}
-{% endfor %} {# for paper in data.papers #}
-{% endif %} {# if data.papers #}
+ </div>
+ </div>
+ <hr/>
+ {% endfor %} {# for question, answers ... #}
+ <div class="form-group">
+ <h3>Teacher comments: </h3>
+ <textarea id="comments_{{paper.question_paper.id}}" class="form-control"
+ name="comments_{{ paper.question_paper.id }}">{{ paper.comments }}</textarea>
+ </div>
+ </div>
+ </div>
+ {% endif %} {# if paper.answers.count #}
+ {% endfor %} {# for paper in data.papers #}
+ {% endif %} {# if data.papers #}
</div>
-
-<br />
-<hr />
-{% with data.papers.0 as paper %}
-<a href="{{URL_ROOT}}/exam/manage/gradeuser/{{paper.question_paper.quiz.id}}/{{ data.user.id }}/{{course_id}}/">Grade/correct paper</a>
-{% endwith %}
-<br />
-{% if data.papers.count > 1 %}
-<a href="{{URL_ROOT}}/exam/manage/monitor/">Monitor quiz</a>
-{% else %}
-{% with data.papers.0 as paper %}
-<a href="{{URL_ROOT}}/exam/manage/monitor/{{paper.question_paper.id}}/">Monitor quiz</a>
-{% endwith %}
-{% endif %}
{% endblock %} \ No newline at end of file
diff --git a/yaksh/urls.py b/yaksh/urls.py
index 3ba2f9e..78e7221 100644
--- a/yaksh/urls.py
+++ b/yaksh/urls.py
@@ -91,7 +91,7 @@ urlpatterns = [
views.user_data, name="user_data"),
url(r'^manage/user_data/(?P<user_id>\d+)/$', views.user_data),
url(r'^manage/quiz/designquestionpaper/(?P<quiz_id>\d+)/$',
- views.design_questionpaper, name='design_questionpaper'),
+ views.design_questionpaper, name='designquestionpaper'),
url(r'^manage/designquestionpaper/(?P<quiz_id>\d+)/'
'(?P<questionpaper_id>\d+)/$',
views.design_questionpaper, name='designquestionpaper'),
diff --git a/yaksh/views.py b/yaksh/views.py
index 67f09e6..5bbe547 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -369,12 +369,9 @@ def add_exercise(request, quiz_id=None, course_id=None):
quiz.duration = 1000
quiz.pass_criteria = 0
quiz.save()
-
- if not course_id:
- return my_redirect("/exam/manage/courses/all_quizzes/")
- else:
- return my_redirect("/exam/manage/courses/")
-
+ messages.success(
+ request, "{0} saved successfully".format(quiz.description)
+ )
else:
form = ExerciseForm(instance=quiz)
context["exercise"] = quiz
@@ -1228,17 +1225,26 @@ def monitor(request, quiz_id=None, course_id=None):
"""Monitor the progress of the papers taken so far."""
user = request.user
- if not user.is_authenticated() or not is_moderator(user):
+ if not is_moderator(user):
raise Http404('You are not allowed to view this page!')
if quiz_id is None:
- course_details = Course.objects.filter(
+ courses = Course.objects.filter(
Q(creator=user) | Q(teachers=user),
is_trial=False
- ).distinct()
+ ).order_by("-id").distinct()
+ paginator = Paginator(courses, 20)
+ page = request.GET.get('page')
+ try:
+ courses = paginator.page(page)
+ except PageNotAnInteger:
+ # If page is not an integer, deliver first page.
+ courses = paginator.page(1)
+ except EmptyPage:
+ # If page is out of range (e.g. 9999), deliver last page of results.
+ courses = paginator.page(paginator.num_pages)
context = {
- "papers": [], "course_details": course_details,
- "msg": "Monitor"
+ "papers": [], "objects": courses, "msg": "Monitor"
}
return my_render_to_response(request, 'yaksh/monitor.html', context)
# quiz_id is not None.
@@ -1506,7 +1512,7 @@ def show_all_questions(request):
user_tags = questions.values_list('tags', flat=True).distinct()
all_tags = Tag.objects.filter(id__in=user_tags)
upload_form = UploadFileForm()
- paginator = Paginator(questions, 10)
+ paginator = Paginator(questions, 30)
page = request.GET.get('page')
try:
questions = paginator.page(page)
@@ -1590,7 +1596,7 @@ def show_all_questions(request):
def user_data(request, user_id, questionpaper_id=None, course_id=None):
"""Render user data."""
current_user = request.user
- if not current_user.is_authenticated() or not is_moderator(current_user):
+ if not is_moderator(current_user):
raise Http404('You are not allowed to view this page!')
user = User.objects.get(id=user_id)
data = AnswerPaper.objects.get_user_data(user, questionpaper_id, course_id)
@@ -1693,12 +1699,22 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None,
and update all their marks and also give comments for each paper.
"""
current_user = request.user
- if not current_user.is_authenticated() or not is_moderator(current_user):
+ if not is_moderator(current_user):
raise Http404('You are not allowed to view this page!')
- course_details = Course.objects.filter(Q(creator=current_user) |
- Q(teachers=current_user),
- is_trial=False).distinct()
- context = {"course_details": course_details}
+ if not course_id:
+ courses = Course.objects.filter(
+ Q(creator=current_user) | Q(teachers=current_user), is_trial=False
+ ).order_by("-id").distinct()
+ paginator = Paginator(courses, 20)
+ page = request.GET.get('page')
+ try:
+ courses = paginator.page(page)
+ except PageNotAnInteger:
+ courses = paginator.page(1)
+ except EmptyPage:
+ courses = paginator.page(paginator.num_pages)
+ context = {"objects": courses}
+
if quiz_id is not None:
questionpaper_id = QuestionPaper.objects.filter(
quiz_id=quiz_id
@@ -1762,6 +1778,7 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None,
paper.comments = request.POST.get(
'comments_%d' % paper.question_paper.id, 'No comments')
paper.save()
+ messages.success(request, "Student data saved successfully")
course_status = CourseStatus.objects.filter(course=course, user=user)
if course_status.exists():
@@ -2706,8 +2723,8 @@ def show_all_quizzes(request):
if not is_moderator(user):
raise Http404('You are not allowed to view this page!')
quizzes = Quiz.objects.filter(creator=user, is_trial=False)
- context = {"quizzes": quizzes, "type": "quiz"}
- return my_render_to_response(request, 'yaksh/courses.html', context)
+ context = {"quizzes": quizzes}
+ return my_render_to_response(request, 'yaksh/quizzes.html', context)
@login_required
@@ -2717,8 +2734,8 @@ def show_all_lessons(request):
if not is_moderator(user):
raise Http404('You are not allowed to view this page!')
lessons = Lesson.objects.filter(creator=user)
- context = {"lessons": lessons, "type": "lesson"}
- return my_render_to_response(request, 'yaksh/courses.html', context)
+ context = {"lessons": lessons}
+ return my_render_to_response(request, 'yaksh/lessons.html', context)
@login_required
@@ -2730,7 +2747,9 @@ def show_all_modules(request):
learning_modules = LearningModule.objects.filter(
creator=user, is_trial=False)
context = {"modules": learning_modules}
- return my_render_to_response(request, 'yaksh/course_added_modules.html', context)
+ return my_render_to_response(
+ request, 'yaksh/modules.html', context
+ )
@login_required