From 43f2313d75e24a8c11855fb9718e48c1c06fb26f Mon Sep 17 00:00:00 2001 From: prathamesh Date: Tue, 3 Jan 2017 10:08:13 +0530 Subject: navbar display was not proper in small devices. modified navabar. Looks better in small devices as well. --- yaksh/templates/base.html | 6 ------ yaksh/templates/manage.html | 7 ++++++- yaksh/templates/user.html | 7 ++++++- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'yaksh') diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html index 1609121..aade07a 100644 --- a/yaksh/templates/base.html +++ b/yaksh/templates/base.html @@ -20,12 +20,6 @@ - {% block meta %} diff --git a/yaksh/templates/manage.html b/yaksh/templates/manage.html index eae4dd4..807a54c 100644 --- a/yaksh/templates/manage.html +++ b/yaksh/templates/manage.html @@ -3,9 +3,14 @@ {% endblock %} +{% block content %} +
+ +
+
+ {% block main %} + {% endblock %} +
+
+
+{% endblock %} diff --git a/yaksh/templates/yaksh/editprofile.html b/yaksh/templates/yaksh/editprofile.html index fc8539d..e5191ad 100644 --- a/yaksh/templates/yaksh/editprofile.html +++ b/yaksh/templates/yaksh/editprofile.html @@ -1,20 +1,13 @@ -{% extends "manage.html" %} - -{% block formtitle %} Please fill in the following details {% endblock %} - -{% block content %} -{% if msg %} -
Your profile does not exist. Please fill in your details
-{% endif %} +{% extends template %} +{% block pagetitle %} Please fill in the following details {% endblock %} +{% block main %}
{% csrf_token %}
- +
{{ form.as_table }}
-
-
+
- -{% endblock content %} +{% endblock main %} diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html index 4ccbbc0..524d76f 100644 --- a/yaksh/templates/yaksh/quizzes_user.html +++ b/yaksh/templates/yaksh/quizzes_user.html @@ -1,14 +1,6 @@ {% extends "user.html" %} - - -{% block subtitle %}Hello {{ user.first_name }}, welcome to your dashboard !{% endblock %} - - -{% block pagetitle %} Student's Dashboard {% endblock pagetitle %} -{% block content %} - -
-
Available Courses

+{% block pagetitle %} {{ title }} {% endblock %} +{% block main %} {% for course in courses %}
@@ -31,93 +23,47 @@
- {% if user in course.students.all %} - {% if cannot_attempt %} -

You have not passed the prerequisite & hence you cannot take the quiz.

- {% endif %} -

List of quizzes available for you

- {% if not quizzes %} -
No active quizzes for you
- {% endif %} - - - - - {% for quiz in quizzes %} - {% if quiz.course_id == course.id %} - - {% if not quiz.is_expired %} - - {% else %} - - {% endif %} + {% if user in course.students.all %} +
QuizView Answer PaperPre requisite quiz
- {{ quiz.description }}
-
- {{ quiz.description }}
- {{ quiz.description }} INACTIVE
-
+ + + + {% for quiz in course.get_quizzes %} + {% if quiz.active and quiz.course_id == course.id %} + + {% if not quiz.is_expired %} + {% else %} - {% endif %} - {% endfor %} -
QuizView Answer PaperPre requisite quiz
- {% if quiz.view_answerpaper %} - Can View - {% else%} - Cannot view now - {% endif %} + {{ quiz.description }}
- {% if quiz.prerequisite %} - You have to pass {{ quiz.prerequisite.description }} for taking {{ paper.quiz.description }} - {% else %} - No pre requisites for {{ quiz.description }} - {% endif %} + {{ quiz.description }} INACTIVE
- {% endif %} + + {% if quiz.view_answerpaper %} + Can View + {% else %} + Cannot view now + {% endif %} + + + {% if quiz.prerequisite %} + You have to pass {{ quiz.prerequisite.description }} for taking {{ paper.quiz.description }} + {% else %} + No pre requisites for {{ quiz.description }} + {% endif %} + + + {% endif %} + {% endfor %} + + {% endif %}

{% endfor %} - -
-

List of quizzes taken by you so far

-{% if quizzes_taken %} - - - - - - - {% for paper in quizzes_taken %} - - - - - - - - {% endfor %} -
QuizResultMarks ObtainedTotal MarksPercentage
- {{ paper.question_paper.quiz.description }} - - {% if paper.passed %} -

Pass

- {% else %} -

Fail

- {% endif %} -
- {{ paper.marks_obtained }} - - {{ paper.question_paper.total_marks }} - - {{ paper.percent }} -
-{% else %} -

You have not taken any quiz yet !!

-{% endif %} - {% endblock %} diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 9dfbda0..9ad5b49 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -2,7 +2,7 @@ {% block pagetitle %} Answer Paper for {{ quiz.description }}{% endblock pagetitle %} -{% block content %} +{% block main %} {% if not data.papers %}

You have not attempted the quiz {{ quiz.description }}

diff --git a/yaksh/templates/yaksh/view_profile.html b/yaksh/templates/yaksh/view_profile.html index becd205..5f06135 100644 --- a/yaksh/templates/yaksh/view_profile.html +++ b/yaksh/templates/yaksh/view_profile.html @@ -1,12 +1,8 @@ -{% extends "base.html" %} +{% extends template %} -{% block pagetitle %} My Profile {% endblock %} -{% block content %} - - +{% block pagetitle %} Profile {% endblock %} +{% block main %} +
@@ -36,4 +32,5 @@
+ Edit Profile {% endblock %} diff --git a/yaksh/urls.py b/yaksh/urls.py index 036c6a3..bdf14ea 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -31,6 +31,7 @@ urlpatterns += [ url(r'^$', views.index), url(r'^login/$', views.user_login, name='login'), url(r'^quizzes/$', views.quizlist_user, name='quizlist_user'), + url(r'^quizzes/(?P\w+)/$', views.quizlist_user, name='quizlist_user'), url(r'^results/$', views.results_user), url(r'^start/$', views.start), url(r'^start/(?P\d+)/$', views.start), diff --git a/yaksh/views.py b/yaksh/views.py index 7ecf6aa..257a383 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -105,18 +105,16 @@ def user_register(request): @login_required -def quizlist_user(request): +def quizlist_user(request, enrolled=None): """Show All Quizzes that is available to logged-in user.""" user = request.user - avail_quizzes = Quiz.objects.get_active_quizzes() - user_answerpapers = AnswerPaper.objects.filter(user=user) - courses = Course.objects.filter(active=True, is_trial=False) - - context = { 'quizzes': avail_quizzes, - 'user': user, - 'courses': courses, - 'quizzes_taken': user_answerpapers, - } + if enrolled is not None: + courses = user.students.all() + title = 'Enrolled Courses' + else: + courses = Course.objects.filter(active=True, is_trial=False) + title = 'All Courses' + context = {'user': user, 'courses': courses, 'title': title} return my_render_to_response("yaksh/quizzes_user.html", context) @@ -1065,10 +1063,14 @@ def view_profile(request): """ view moderators and users profile """ user = request.user ci = RequestContext(request) - - context = {} + if is_moderator(user): + template = 'manage.html' + else: + template = 'user.html' + context = {'template': template} if has_profile(user): - return my_render_to_response('yaksh/view_profile.html', {'user':user}) + context['user'] = user + return my_render_to_response('yaksh/view_profile.html', context) else: form = ProfileForm(user=user) msg = True @@ -1082,10 +1084,13 @@ def view_profile(request): def edit_profile(request): """ edit profile details facility for moderator and students """ - context = {} user = request.user ci = RequestContext(request) - + if is_moderator(user): + template = 'manage.html' + else: + template = 'user.html' + context = {'template': template} if has_profile(user): profile = Profile.objects.get(user_id=user.id) else: -- cgit From fe6c5c3b561c514fa328807fb8a571a620e438cf Mon Sep 17 00:00:00 2001 From: prathamesh Date: Thu, 12 Jan 2017 18:20:38 +0530 Subject: Exam interface improved --- yaksh/python_assertion_evaluator.py | 2 +- yaksh/static/yaksh/css/dashboard.css | 17 ++-- yaksh/templates/base.html | 3 +- yaksh/templates/exam.html | 78 +++++++++++++++++ yaksh/templates/user.html | 2 +- yaksh/templates/yaksh/question.html | 163 ++++++++++++----------------------- 6 files changed, 149 insertions(+), 116 deletions(-) create mode 100644 yaksh/templates/exam.html (limited to 'yaksh') diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 749a6ec..8ff88b4 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -77,7 +77,7 @@ class PythonAssertionEvaluator(BaseEvaluator): fname, lineno, func, text = info[-1] text = str(self.test_case) err = "Expected Test Case:\n{0}\n" \ - "Error - {1} {2} in: {3}\n".format( + "Error - {1} {2} in:\n {3}\n".format( self.test_case, type.__name__, str(value), diff --git a/yaksh/static/yaksh/css/dashboard.css b/yaksh/static/yaksh/css/dashboard.css index bf76ec6..3049ef0 100644 --- a/yaksh/static/yaksh/css/dashboard.css +++ b/yaksh/static/yaksh/css/dashboard.css @@ -4,7 +4,7 @@ /* Move down content because we have a fixed navbar that is 50px tall */ body { - padding-top: 50px; + padding-top:30px; } @@ -68,17 +68,21 @@ body { */ .main { - padding: 20px; + padding: 0px; } @media (min-width: 768px) { .main { - padding-right: 40px; - padding-left: 40px; + padding-right: 0px; + padding-left: 0px; } } -.main .page-header { +.main { margin-top: 0; } +.header { + margin: 30px 0 15px; + border-bottom: 1px solid #eee; +} /* @@ -99,3 +103,6 @@ body { display: inline-block; border-radius: 50%; } +.sidebar-right { + float: right; +} diff --git a/yaksh/templates/base.html b/yaksh/templates/base.html index b2560e8..35c6976 100644 --- a/yaksh/templates/base.html +++ b/yaksh/templates/base.html @@ -18,6 +18,7 @@ + {% block meta %} @@ -39,7 +40,7 @@ {% endblock %}
- -
- -{% endblock %} -{% block pagetitle %} Yaksh Online Test {% endblock pagetitle %} +{% block pagetitle %} {{ paper.question_paper.quiz.description }} {% endblock pagetitle %} {% block css %} + + {% endblock %} {% block script %} @@ -95,43 +88,52 @@ function call_skip(url) form.submit(); } + {% endblock script %} {% block onload %} onload="updateTime();" {% endblock %} -{% block content %} -
-
- -
-
-

{{ paper.questions_left }} question(s) left in {{ paper.question_paper.quiz.description }}

-
-
-
- {% csrf_token %} - -
-
- -
+{% block main %}

{% csrf_token %} @@ -200,13 +202,13 @@ function call_skip(url) {% endif %} {% if question.type == "code" %}
-
-

Program:

+
+

Write your program below:

- +

{% endif %} @@ -223,28 +225,10 @@ function call_skip(url) {% endif %}
- {% if question.type == "code" %} -
- + +{% endblock main %} - -{% endblock content %} -- cgit From 5ee9b4647c7f1ba9803a95ad3871f6acfc92c1c0 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Fri, 13 Jan 2017 16:48:16 +0530 Subject: removed unwanted css. Modified test. --- yaksh/evaluator_tests/test_python_evaluation.py | 10 +++++----- yaksh/static/yaksh/css/dashboard.css | 19 ------------------- 2 files changed, 5 insertions(+), 24 deletions(-) (limited to 'yaksh') diff --git a/yaksh/evaluator_tests/test_python_evaluation.py b/yaksh/evaluator_tests/test_python_evaluation.py index c58d7f1..43dfe6b 100644 --- a/yaksh/evaluator_tests/test_python_evaluation.py +++ b/yaksh/evaluator_tests/test_python_evaluation.py @@ -76,13 +76,13 @@ class PythonAssertionEvaluationTestCases(EvaluatorBaseTest): # Then self.assertFalse(result.get('success')) - self.assert_correct_output('AssertionError in: assert(add(1,2)==3)', + self.assert_correct_output('AssertionError in:\n assert(add(1,2)==3)', result.get('error') ) - self.assert_correct_output('AssertionError in: assert(add(-1,2)==1)', + self.assert_correct_output('AssertionError in:\n assert(add(-1,2)==1)', result.get('error') ) - self.assert_correct_output('AssertionError in: assert(add(-1,-2)==-3)', + self.assert_correct_output('AssertionError in:\n assert(add(-1,-2)==-3)', result.get('error') ) @@ -110,10 +110,10 @@ class PythonAssertionEvaluationTestCases(EvaluatorBaseTest): # Then self.assertFalse(result.get('success')) self.assertEqual(result.get('weight'), 2.0) - self.assert_correct_output('AssertionError in: assert(add(-1,2)==1)', + self.assert_correct_output('AssertionError in:\n assert(add(-1,2)==1)', result.get('error') ) - self.assert_correct_output('AssertionError in: assert(add(-1,-2)==-3)', + self.assert_correct_output('AssertionError in:\n assert(add(-1,-2)==-3)', result.get('error') ) diff --git a/yaksh/static/yaksh/css/dashboard.css b/yaksh/static/yaksh/css/dashboard.css index 3049ef0..28040c4 100644 --- a/yaksh/static/yaksh/css/dashboard.css +++ b/yaksh/static/yaksh/css/dashboard.css @@ -84,25 +84,6 @@ body { border-bottom: 1px solid #eee; } - -/* - * Placeholder dashboard ideas - */ - -.placeholders { - margin-bottom: 30px; - text-align: center; -} -.placeholders h4 { - margin-bottom: 0; -} -.placeholder { - margin-bottom: 20px; -} -.placeholder img { - display: inline-block; - border-radius: 50%; -} .sidebar-right { float: right; } -- cgit From 51ddfe4b5876c99077db9de130eec01a40787d59 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Fri, 13 Jan 2017 17:00:44 +0530 Subject: rectified the test for mcq incorrect. --- yaksh/test_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yaksh') diff --git a/yaksh/test_models.py b/yaksh/test_models.py index 1a6bcba..91d8806 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -609,7 +609,7 @@ class AnswerPaperTestCases(unittest.TestCase): def test_mcq_incorrect_answer(self): # Given - mcq_answer = 'a' + mcq_answer = 'b' self.answer = Answer(question=self.question2, answer=mcq_answer, ) @@ -623,7 +623,7 @@ class AnswerPaperTestCases(unittest.TestCase): ) # Then - self.assertTrue(result['success']) + self.assertFalse(result['success']) def test_mcc_incorrect_answer(self): # Given -- cgit