diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/templates/yaksh/add_course.html | 5 | ||||
-rw-r--r-- | yaksh/templates/yaksh/courses.html | 36 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 31 | ||||
-rw-r--r-- | yaksh/templates/yaksh/lessons.html | 12 | ||||
-rw-r--r-- | yaksh/templates/yaksh/moderator_dashboard.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/modules.html | 11 | ||||
-rw-r--r-- | yaksh/templates/yaksh/monitor.html | 27 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quizzes.html | 12 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quizzes_user.html | 82 | ||||
-rw-r--r-- | yaksh/templates/yaksh/showquestions.html | 9 | ||||
-rw-r--r-- | yaksh/urls.py | 4 | ||||
-rw-r--r-- | yaksh/views.py | 59 |
12 files changed, 134 insertions, 156 deletions
diff --git a/yaksh/templates/yaksh/add_course.html b/yaksh/templates/yaksh/add_course.html index 11a6497..72403ce 100644 --- a/yaksh/templates/yaksh/add_course.html +++ b/yaksh/templates/yaksh/add_course.html @@ -22,11 +22,6 @@ </a> </li> <li class="nav-item"> - <a class="nav-link" href="{% url 'yaksh:allotted_courses' %}"> - Allotted Courses - </a> - </li> - <li class="nav-item"> <a class="nav-link active" href="{% url 'yaksh:add_course' %}"> Add New Course </a> diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html index de8684f..2544956 100644 --- a/yaksh/templates/yaksh/courses.html +++ b/yaksh/templates/yaksh/courses.html @@ -22,11 +22,6 @@ </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> @@ -52,13 +47,13 @@ </div> </div> </div> - {% if not objects %} - <center> - <h2> No Courses Found </h2> - <br> - </center> - {% else %} - <div class="container"> + <div class="container"> + {% if not objects %} + <br><br> + <div class="alert alert-info"> + <center> <h3> No Courses Found </h3> </center> + </div> + {% else %} <hr> {% if messages %} {% for message in messages %} @@ -92,7 +87,18 @@ </div> <hr> <div class="row"> - <div class="col-md-6"> + <div class="col-md-5"> + {% if user.id != course.creator.id %} + <span class="badge badge-pill badge-secondary"> + Allotted Course + </span> + {% else %} + <span class="badge badge-pill badge-info"> + Created Course + </span> + {% endif %} + </div> + <div class="col-md-3"> {% if course.active %} <span class="badge badge-pill badge-success"> Active @@ -103,8 +109,8 @@ </span> {% endif %} </div> - <div class="col-md-6"> - <a href="{{URL_ROOT}}/exam/manage/toggle_status/{{ course.id }}/"> + <div class="col-md-4"> + <a href="{% url 'yaksh:toggle_course_status' course.id %}"> {% if course.active %} <i class="fa fa-toggle-on fa-2x"></i> {% else %} diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index a8472c7..e3888b8 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -76,11 +76,16 @@ $(document).ready(function() {% endfor %} </div> {% include "yaksh/paginator.html" %} +{% elif msg == 'grade' and not objects %} + <br> + <div class="alert alert-info"> + <center><h3>No courses found to grade</h3></center> + </div> {% endif %} </div> <div class="container-fluid"> <div class="row"> - {% if not objects %} + {% if status == "grade" %} {% if users %} <div id="student" class="col-md-3"> <ul class="nav nav-pills list-group"> @@ -149,7 +154,7 @@ $(document).ready(function() </div> <hr> {% if data.papers %} - {% for paper in data.papers %} + {% with data.papers.0 as paper %} <div class="card"> <div class="card-header"> Course Details @@ -159,8 +164,24 @@ $(document).ready(function() <div class="col-md-6"> <p><b>Course:</b> {{ paper.course.name }}</p> <p><b>Quiz:</b> {{ paper.question_paper.quiz.description }}</p> + </div> + <div class="col-md-6"> <p><b>Start time:</b> {{ paper.start_time }}</p> <p><b>End time:</b> {{ paper.end_time }}</p> + </div> + </div> + </div> + </div> + {% endwith %} + {% for paper in data.papers %} + <hr> + <div class="card"> + <div class="card-header"> + Scorecard + </div> + <div class="card-body"> + <div class="row"> + <div class="col-md-4"> <p><b>Status:</b> {% if paper.passed %} <span class="badge badge-pill badge-success"> Passed </span> @@ -168,16 +189,16 @@ $(document).ready(function() <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> + </div> + <div class="col-md-4"> {% 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> + <b>Attempt Number:</b> <span class="badge badge-pill badge-info"> {{paper.attempt_number}} </span> diff --git a/yaksh/templates/yaksh/lessons.html b/yaksh/templates/yaksh/lessons.html index 6bdc762..0146a6b 100644 --- a/yaksh/templates/yaksh/lessons.html +++ b/yaksh/templates/yaksh/lessons.html @@ -12,11 +12,6 @@ </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> @@ -42,15 +37,16 @@ </div> </div> </div> -<br> <div class="container"> + <hr> <a href="{% url 'yaksh:edit_lesson' %}" class="btn btn-primary btn-lg"> <i class="fa fa-plus-circle"></i> Add new Lesson </a> {% if not lessons %} <br><br> - <center><h4> No new Lessons added</h4></center> - <br><br> + <div class="alert alert-info"> + <center><h3> No new Lessons added</h3></center> + </div> {% else %} <center><h3> Lessons </h3></center> <table id="course-details" class="table table-bordered table-responsive-sm"> diff --git a/yaksh/templates/yaksh/moderator_dashboard.html b/yaksh/templates/yaksh/moderator_dashboard.html index 5d0de7b..b2d38b0 100644 --- a/yaksh/templates/yaksh/moderator_dashboard.html +++ b/yaksh/templates/yaksh/moderator_dashboard.html @@ -34,7 +34,7 @@ {% with objects as courses %} <br> {% if not courses %} - <div class="alert alert-secondary"> + <div class="alert alert-info"> No Courses found. Add a new course or Create demo course </div> {% else %} diff --git a/yaksh/templates/yaksh/modules.html b/yaksh/templates/yaksh/modules.html index 4edbf7d..4fafbf1 100644 --- a/yaksh/templates/yaksh/modules.html +++ b/yaksh/templates/yaksh/modules.html @@ -13,11 +13,6 @@ </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> @@ -43,14 +38,16 @@ </div> </div> </div> -<br> <div class="container"> + <hr> <a href="{% url 'yaksh:add_module' %}" class="btn btn-primary btn-lg"> <i class="fa fa-plus-circle"></i> Add new Module </a> {% if not modules %} - <center><h4> No new learning modules added</h4></center> <br><br> + <div class="alert alert-info"> + <center><h3> No new learning modules added</h3></center> + </div> {% else %} <center><h3> Learning Modules </h3></center> <table class="table table-bordered table-responsive-sm"> diff --git a/yaksh/templates/yaksh/monitor.html b/yaksh/templates/yaksh/monitor.html index 51ca73e..cf6888c 100644 --- a/yaksh/templates/yaksh/monitor.html +++ b/yaksh/templates/yaksh/monitor.html @@ -2,7 +2,7 @@ {% load custom_filters %} {% load static %} {% block title %} Monitor {% endblock %} -{% block pagetitle %} {{ msg }} {% endblock pagetitle %} +{% block pagetitle %} Monitor {% endblock pagetitle %} {% block meta %} <meta http-equiv="refresh" content="30"/> {% endblock meta %} @@ -87,8 +87,13 @@ $(document).ready(function() {% endfor %} </div> {% include "yaksh/paginator.html" %} - {% endif %} + {% elif msg == 'Monitor' and not objects %} + <br> + <div class="alert alert-info"> + <center><h3>No courses to monitor</h3></center> + </div> + {% endif %} {# ############################################################### #} {# This is rendered when we are just viewing exam/monitor/quiz_num #} {% if msg != "Monitor" %} @@ -176,7 +181,7 @@ $(document).ready(function() <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> - <h3 class="modal-title">Uncheck unwanted columns</h3> + <h3 class="modal-title">Download CSV for {{quiz.description}} </h3> <button type="button" class="close" data-dismiss="modal"> <i class="fa fa-close"></i> </button> @@ -184,13 +189,15 @@ $(document).ready(function() <form action="{% url 'yaksh:download_quiz_csv' course.id quiz.id %}" method="post"> {% csrf_token %} <div class="modal-body"> + <b>Uncheck unwanted columns</b> + <br> {% 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> + <br> {% endfor %} <b>Select Attempt Number: Default latest attempt</b> <select class="form-control" name = "attempt_number"> @@ -204,7 +211,9 @@ $(document).ready(function() </select> </div> <div class="modal-footer"> - <button type="submit" class="btn btn-primary"> Download <span class="glyphicon glyphicon-save"></span></button> + <button type="submit" class="btn btn-success"> + <span class="fa fa-save"></span> Download + </button> <button type="button" class="btn btn-secondary" data-dismiss="modal"> Close </button> @@ -214,7 +223,13 @@ $(document).ready(function() </div> </div> {% else %} - <p> No answer papers found for {{ quiz.description }}</p> + <div class="col-md-12"> + <div class="alert alert-warning"> + <center> + <h4>No Users Found for {{ quiz.description }}</h4> + </center> + </div> + </div> {% endif %} {# if papers #} {% else %} <h4>No Quiz Found</h4> diff --git a/yaksh/templates/yaksh/quizzes.html b/yaksh/templates/yaksh/quizzes.html index d42716c..7e53d31 100644 --- a/yaksh/templates/yaksh/quizzes.html +++ b/yaksh/templates/yaksh/quizzes.html @@ -13,11 +13,6 @@ </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> @@ -43,8 +38,8 @@ </div> </div> </div> -<br> <div class="container"> + <hr> <a href="{% url 'yaksh:add_quiz' %}" class="btn btn-primary btn-lg"> <i class="fa fa-plus-circle"></i> Add New Quiz </a> @@ -53,8 +48,9 @@ </a> {% if not quizzes %} <br><br> - <center><h4> No new Quiz added</h4></center> - <br><br> + <div class="alert alert-info"> + <center><h3> No new Quiz added</h3></center> + </div> {% else %} <center><h3> Quizzes </h3></center> <table class="table table-bordered table-responsive-sm"> diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html index 1a708ef..7771954 100644 --- a/yaksh/templates/yaksh/quizzes_user.html +++ b/yaksh/templates/yaksh/quizzes_user.html @@ -7,56 +7,32 @@ {% block main %} <div class="container"> - {% block navtab %} - {% if 'Enrolled Courses' not in title%} - <div class="container"> - <div class="nav nav-pills"> - <li class="nav-item" > - <a class="active nav-link" href="{% url 'yaksh:quizlist_user' %}"> - All Courses - </a> - </li> - <li class="nav-item"> - <a class="nav-link" href="{% url 'yaksh:quizlist_user' 'enrolled' %}"> - Enrolled Courses - </a> - </li> - </div> - </div> - <hr> - <div class="row justify-content-center"> - <div class="col-md-8"> - <form action="{% url 'yaksh:quizlist_user' %}" method="post" id="custom-search-form" > - {% csrf_token %} - <div class="col-md-12"> - <div class="input-group"> - <input type="text" name="course_code" class="form-control" type="search" placeholder="Enter course code to search"> - <span class="input-group-append"> - <button class="btn btn-outline-primary" type="submit"><i class="fa fa-search"></i> Search</button> - </span> - </div> - </div> - </form> + <center> + <h2>All Courses</h2> + </center> + <hr> + <div class="row justify-content-center"> + <div class="col-md-8"> + <form action="{% url 'yaksh:quizlist_user' %}" method="post" id="custom-search-form" > + {% csrf_token %} + <div class="col-md-12"> + <div class="input-group"> + <input type="text" name="course_code" class="form-control" type="search" placeholder="Enter course code to search" required=""> + <span class="input-group-append"> + <button class="btn btn-outline-info" type="submit"><i class="fa fa-search"></i> Search</button> + </span> + </div> </div> - </div> - {% else %} - <div class="container"> - <div class="nav nav-pills"> - <li class="nav-item" > - <a class="nav-link" href="{% url 'yaksh:quizlist_user' %}"> - All Courses - </a> - </li> - <li class="nav-item"> - <a class="active nav-link" href="{% url 'yaksh:quizlist_user' 'enrolled' %}"> - Enrolled Courses - </a> - </li> - </div> + </form> + </div> + {% if title == "Search" %} + <div class="col-md-4"> + <a href="{% url 'yaksh:quizlist_user' %}" class="btn btn-primary"> + <i class="fa fa-times"></i> Clear search + </a> </div> - <hr> {% endif %} - {% endblock %} + </div> <br> {% if messages %} {% for message in messages %} @@ -66,18 +42,10 @@ </button> <strong>{{ message }}</strong> </div> + <br> {% endfor %} {% endif %} - <br> - {% if msg %} - <div class="alert alert-dismissible alert-warning"> - <button type="button" class="close" data-dismiss="alert"> - <i class="fa fa-close"></i> - </button> - <strong>{{ msg }}</strong> - </div> - {% endif %} - <br> + {% if not courses %} <center><div class="col-md-8 alert alert-warning" role="alert"> No Courses to display diff --git a/yaksh/templates/yaksh/showquestions.html b/yaksh/templates/yaksh/showquestions.html index f9fac96..895c345 100644 --- a/yaksh/templates/yaksh/showquestions.html +++ b/yaksh/templates/yaksh/showquestions.html @@ -188,6 +188,11 @@ </div> </div> {% include "yaksh/paginator.html" %} + {% else %} + <br><br> + <div class="alert alert-info"> + <center><h3>No Questions created</h3></center> + </div> {% endif %} </div> <br> @@ -195,9 +200,9 @@ {% if questions %} <button class="btn btn-lg btn-primary" type="submit" name='download' value='download'><i class="fa fa-download"></i> Download Selected</button> <button class="btn btn-lg btn-primary" type="submit" name="test" value="test">Test Selected</button> + <button class="btn btn-lg btn-danger" type="submit" onClick="return confirm_delete(frm);" name='delete' value='delete'> + <i class="fa fa-trash"></i> Delete Selected</button> {% endif %} - <button class="btn btn-lg btn-danger" type="submit" onClick="return confirm_delete(frm);" name='delete' value='delete'> - <i class="fa fa-trash"></i> Delete Selected</button> </center> </form> </div> diff --git a/yaksh/urls.py b/yaksh/urls.py index e9f3539..49c3d4f 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -11,8 +11,6 @@ urlpatterns = [ url(r'^toggle_moderator/$', views.toggle_moderator_role, name='toggle_moderator'), url(r'^quizzes/$', views.quizlist_user, name='quizlist_user'), - url(r'^quizzes/(?P<enrolled>\w+)/$', views.quizlist_user, - name='quizlist_user'), url(r'^results/$', views.results_user), url(r'^start/(?P<questionpaper_id>\d+)/(?P<module_id>\d+)/' '(?P<course_id>\d+)/$', views.start, name="start_quiz"), @@ -112,8 +110,6 @@ urlpatterns = [ url(r'^manage/duplicate_course/(?P<course_id>\d+)/$', views.duplicate_course, name='duplicate_course'), url(r'manage/courses/$', views.courses, name='courses'), - url(r'manage/allotted/courses/$', views.allotted_courses, - name='allotted_courses'), url(r'manage/add_course/$', views.add_course, name='add_course'), url(r'manage/edit_course/(?P<course_id>\d+)$', views.add_course, name='edit_course'), diff --git a/yaksh/views.py b/yaksh/views.py index 6d70766..28515fd 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -175,15 +175,16 @@ def quizlist_user(request, enrolled=None, msg=None): hidden_courses = Course.objects.get_hidden_courses(code=course_code) courses = hidden_courses title = 'Search' - elif enrolled is not None: - courses = user.students.filter(is_trial=False).order_by('-id') - title = 'Enrolled Courses' else: - courses = Course.objects.filter( - active=True, is_trial=False + courses = list(Course.objects.filter( + active=True, is_trial=False, ).exclude( ~Q(requests=user), ~Q(rejected=user), hidden=True - ).order_by('-id') + ).order_by('-id')) + enrolled_course = list( + user.students.filter(is_trial=False).order_by('-id') + ) + courses.extend(enrolled_course) title = 'All Courses' for course in courses: @@ -198,9 +199,10 @@ def quizlist_user(request, enrolled=None, msg=None): } ) + messages.info(request, msg) context = { 'user': user, 'courses': courses_data, - 'title': title, 'msg': msg + 'title': title } return my_render_to_response(request, "yaksh/quizzes_user.html", context) @@ -405,8 +407,8 @@ def prof_manage(request, msg=None): return my_redirect('/exam/') courses = Course.objects.get_queryset().filter( Q(creator=user) | Q(teachers=user), - is_trial=False).distinct().order_by("-id") - paginator = Paginator(courses, 10) + is_trial=False).distinct().order_by("-active") + paginator = Paginator(courses, 30) page = request.GET.get('page') try: courses = paginator.page(page) @@ -1041,8 +1043,9 @@ def courses(request): if not is_moderator(user): raise Http404('You are not allowed to view this page') courses = Course.objects.filter( - creator=user, is_trial=False).order_by('-id') - paginator = Paginator(courses, 20) + Q(creator=user) | Q(teachers=user), + is_trial=False).order_by('-active').distinct() + paginator = Paginator(courses, 30) page = request.GET.get('page') try: courses = paginator.page(page) @@ -1058,28 +1061,6 @@ def courses(request): @login_required @email_verified -def allotted_courses(request): - user = request.user - if not is_moderator(user): - raise Http404('You are not allowed to view this page') - allotted_courses = Course.objects.filter( - teachers=user, is_trial=False).order_by('-id') - paginator = Paginator(allotted_courses, 20) - page = request.GET.get('page') - try: - allotted_courses = paginator.page(page) - except PageNotAnInteger: - # If page is not an integer, deliver first page. - allotted_courses = paginator.page(1) - except EmptyPage: - # If page is out of range (e.g. 9999), deliver last page of results. - allotted_courses = paginator.page(paginator.num_pages) - context = {'allotted': True, "objects": allotted_courses} - return my_render_to_response(request, 'yaksh/courses.html', context) - - -@login_required -@email_verified def course_detail(request, course_id): user = request.user @@ -1256,7 +1237,7 @@ def monitor(request, quiz_id=None, course_id=None): Q(creator=user) | Q(teachers=user), is_trial=False ).order_by("-id").distinct() - paginator = Paginator(courses, 20) + paginator = Paginator(courses, 30) page = request.GET.get('page') try: courses = paginator.page(page) @@ -1727,7 +1708,7 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None, courses = Course.objects.filter( Q(creator=current_user) | Q(teachers=current_user), is_trial=False ).order_by("-id").distinct() - paginator = Paginator(courses, 20) + paginator = Paginator(courses, 30) page = request.GET.get('page') try: courses = paginator.page(page) @@ -1735,7 +1716,7 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None, courses = paginator.page(1) except EmptyPage: courses = paginator.page(paginator.num_pages) - context = {"objects": courses} + context = {"objects": courses, "msg": "grade"} if quiz_id is not None: questionpaper_id = QuestionPaper.objects.filter( @@ -1758,7 +1739,8 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None, "quiz_id": quiz_id, "quiz": quiz, "has_quiz_assignments": has_quiz_assignments, - "course_id": course_id + "course_id": course_id, + "status": "grade" } if user_id is not None: attempts = AnswerPaper.objects.get_user_all_attempts( @@ -1785,7 +1767,8 @@ def grade_user(request, quiz_id=None, user_id=None, attempt_number=None, "user_id": user_id, "has_user_assignments": has_user_assignments, "has_quiz_assignments": has_quiz_assignments, - "course_id": course_id + "course_id": course_id, + "status": "grade" } if request.method == "POST": papers = data['papers'] |