diff options
Diffstat (limited to 'testapp')
-rw-r--r-- | testapp/exam/views.py | 16 | ||||
-rw-r--r-- | testapp/templates/manage.html | 63 |
2 files changed, 56 insertions, 23 deletions
diff --git a/testapp/exam/views.py b/testapp/exam/views.py index c4c03df..c58ce89 100644 --- a/testapp/exam/views.py +++ b/testapp/exam/views.py @@ -569,15 +569,21 @@ def manual_questionpaper(request, questionpaper_id=None): def prof_manage(request): """Take credentials of the user with professor/moderator - rights/permissions and log in.""" +rights/permissions and log in.""" user = request.user - if user.is_authenticated()\ - and user.groups.filter(name='moderator').count() > 0: - context = {'user': user} + if user.is_authenticated() and is_moderator(user): + question_papers = QuestionPaper.objects.all() + users_per_paper = [] + for paper in question_papers: + answer_papers = AnswerPaper.objects.filter(question_paper=paper) + users_passed = AnswerPaper.objects.filter(question_paper=paper, passed=True).count() + users_failed = AnswerPaper.objects.filter(question_paper=paper, passed=False).count() + temp = paper, answer_papers, users_passed, users_failed + users_per_paper.append(temp) + context = {'user': user, 'users_per_paper':users_per_paper} return my_render_to_response('manage.html', context) return my_redirect('/exam/login/') - def user_login(request): """Take the credentials of the user and log the user in.""" diff --git a/testapp/templates/manage.html b/testapp/templates/manage.html index 0f122b0..1db8a78 100644 --- a/testapp/templates/manage.html +++ b/testapp/templates/manage.html @@ -1,6 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> @@ -9,12 +6,13 @@ </title> {% block meta %} - <meta charset="utf-8"> - <meta name="description" content=""> - <meta name="author" content=""> +<meta charset="utf-8"> + <meta name="description" content=""> +<meta name="author" content=""> {% endblock %} - <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/base.css" type="text/css" /> + <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/base.css" type="text/css" /> + <link rel="stylesheet" href="{{ URL_ROOT }}/static/exam/css/manage.css" type="text/css" /> {% block css %} {% endblock %} @@ -26,16 +24,15 @@ <div class="topbar"> <div class="fill"> <div class="container"> - <h3 class="brand"><strong>Online Test</h3></strong> - <ul> - <li><a href="{{ URL_ROOT }}/exam/manage/questions">Questions</a></li> + <a href="{{ URL_ROOT }}/exam/manage/"><h3 class="brand"><strong>Online Test</h3></strong></a> +<ul> +<li><a href="{{ URL_ROOT }}/exam/manage/questions">Questions</a></li> <li><a href="{{ URL_ROOT }}/exam/manage/showquiz">Quizzes</a></li> - <li><a href="{{ URL_ROOT }}/exam/manage/showquestionpapers">Question Papers</a></li> - <li><a href="{{ URL_ROOT }}/exam/manage/gradeuser">Grade User</a></li> - <li><a href="{{ URL_ROOT }}/exam/manage/monitor">Monitor</a></li> + <li><a href="{{ URL_ROOT }}/exam/manage/gradeuser">Grade User</a></li> +<li><a href="{{ URL_ROOT }}/exam/manage/monitor">Monitor</a></li> </ul> - <ul style="float:right;"> - <li><strong><a style='cursor:pointer' onClick='location.replace("{{URL_ROOT}}/exam/complete/");'>Log out</a></strong></li> +<ul style="float:right;"> +<li><strong><a style='cursor:pointer' onClick='location.replace("{{URL_ROOT}}/exam/complete/");'>Log out</a></strong></li> </ul> </div> </div> @@ -43,12 +40,42 @@ <div class="container"> <div class="content"> <div class="page-header"> - <h3><center>{% block subtitle %}Welcome {{ user.first_name.title }} {{user.last_name.title}} {% endblock %}</center></h3><br> +<h3><center>{% block subtitle %}Welcome {{ user.first_name.title }} {{user.last_name.title}} !{% endblock %}</center></h3><br> </div> <div class=row> <div class=span14> - {% block manage %} - {% endblock %} + {% block manage %} + <center><h4>List of quizzes! Click on the given links to have a look at answer papers for a quiz.</h4></center> + <hr> + <table class="bordered-table zebra-striped"> + <th>Quiz</th> + <th>Taken By</th> + <th>No. of users Passed</th> + <th>No. of users Failed</th> + {% for paper, answer_papers, users_passed, users_failed in users_per_paper %} + <tr> + <td> + <a href="{{URL_ROOT}}/exam/manage/monitor/{{paper.id}}/">{{ paper.quiz.description }}</a> + </td> + <td> + {{ answer_papers|length }} user(s) + </td> + <td> + {{ users_passed }} + </td> + <td> + {{ users_failed }} + </td> + </tr> + {% endfor %} + </table> + <hr> + <center> + <h4>Moderator's Dashboard!</h4> + <h5>Click on the button given below to add a new quiz.</h5> + <button class="btn" type="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/addquiz");'>Add New Quiz</button> + </center> +{% endblock %} </div> </div> </div> |