diff options
-rw-r--r-- | Quiz_instructions.txt | 18 | ||||
-rw-r--r-- | yaksh/models.py | 7 | ||||
-rw-r--r-- | yaksh/static/yaksh/js/add_quiz.js | 6 | ||||
-rw-r--r-- | yaksh/templates/yaksh/add_quiz.html | 11 | ||||
-rw-r--r-- | yaksh/templates/yaksh/intro.html | 19 | ||||
-rw-r--r-- | yaksh/test_models.py | 5 | ||||
-rw-r--r-- | yaksh/test_views.py | 12 |
7 files changed, 52 insertions, 26 deletions
diff --git a/Quiz_instructions.txt b/Quiz_instructions.txt new file mode 100644 index 0000000..34e010f --- /dev/null +++ b/Quiz_instructions.txt @@ -0,0 +1,18 @@ +<p> +This examination system has been developed with the intention of making you +learn programming and be assessed in an interactive and fun manner. +You will be presented with a series of programming questions and problems that +you will answer online and get immediate feedback for. +</p> +<p> Here are some important instructions and rules that you should understand carefully.</p> +<ul> +<li>For any programming questions, you can submit solutions as many times as you want without a penalty. You may skip questions and solve them later. +</li> +<li> You <strong>may</strong> use your computer's Python/IPython shell or an editor to solve the problem and cut/paste the solution to the web interface. +</li> +<li> <strong>You are <strong>not allowed</strong> to use any internet resources, i.e. no google etc.</strong> </li> +<li> Do not copy or share the questions or answers with anyone until the exam is complete <strong>for everyone</strong>.</li> +<li> <strong>All</strong> your attempts at the questions are logged. Do not try to outsmart and break the testing system. If you do, we know who you are and we will expel you from the course. You have been warned. +</li> +</ul> +<p> We hope you enjoy taking this exam !!!</p> diff --git a/yaksh/models.py b/yaksh/models.py index 77e77ee..7fae305 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -81,6 +81,10 @@ def has_profile(user): def get_upload_dir(instance, filename): return "question_%s/%s" % (instance.question.id, filename) +def get_quiz_instructions_info(): + file_path = os.path.join(os.getcwd(), "Quiz_instructions.txt") + with open(file_path, 'r') as file: + return file.read() ############################################################################### class CourseManager(models.Manager): @@ -535,6 +539,9 @@ class Quiz(models.Model): is_trial = models.BooleanField(default=False) + instructions = models.TextField('Instructions for Students', + default=get_quiz_instructions_info) + view_answerpaper = models.BooleanField('Allow student to view their answer\ paper', default=False) diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js index 3da4d5c..f4067ed 100644 --- a/yaksh/static/yaksh/js/add_quiz.js +++ b/yaksh/static/yaksh/js/add_quiz.js @@ -7,6 +7,12 @@ function test() { document.getElementById("submit").innerHTML = "Save"; } + var template = "<p id='rendered_text' align='justify'></p>"; + $(template).insertBefore("#id_instructions"); + $('#id_instructions').keypress(function (event){ + document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; + }); + document.getElementById('rendered_text').innerHTML = document.getElementById('id_instructions').value ; } String.prototype.beginsWith = function (string) { diff --git a/yaksh/templates/yaksh/add_quiz.html b/yaksh/templates/yaksh/add_quiz.html index 2df97a2..38773b5 100644 --- a/yaksh/templates/yaksh/add_quiz.html +++ b/yaksh/templates/yaksh/add_quiz.html @@ -20,14 +20,16 @@ <center> <table class=span1> {{ form.as_table }} + </table> <script type="text/javascript"> $("#id_start_date_time").datetimepicker({format: 'Y-m-d H:i:s'}); $("#id_end_date_time").datetimepicker({format: 'Y-m-d H:i:s'}); </script> - </table> + <br/><br/> </center> - <center><button class="btn" type="submit" id="submit" name="questionpaper"> Save </button> + <center><button class="btn" type="submit" id="submit" name="questionpaper"> Save + </button> <button class="btn" type="button" name="button" onClick='location.replace("{{URL_ROOT}}/exam/manage/courses/");'>Cancel</button> </center> @@ -55,4 +57,9 @@ <a href="" onclick="$('#help').hide(); return false"> Close </a> </div> {% endif %} + <style type="text/css"> + #rendered_text{ + width: 550px; + } + </style> {% endblock %} diff --git a/yaksh/templates/yaksh/intro.html b/yaksh/templates/yaksh/intro.html index 81c460f..29723fa 100644 --- a/yaksh/templates/yaksh/intro.html +++ b/yaksh/templates/yaksh/intro.html @@ -21,24 +21,7 @@ </div> {% endif %} <p> Welcome <strong>{{user.first_name.title}} {{user.last_name.title}}</strong>, to the programming quiz! </p> - <p> - This examination system has been developed with the intention of making you - learn programming and be assessed in an interactive and fun manner. - You will be presented with a series of programming questions and problems that - you will answer online and get immediate feedback for. - </p> - <p> Here are some important instructions and rules that you should understand carefully.</p> - <ul> - <li>For any programming questions, you can submit solutions as many times as you want without a penalty. You may skip questions and solve them later. - </li> - <li> You <strong>may</strong> use your computer's Python/IPython shell or an editor to solve the problem and cut/paste the solution to the web interface. - </li> - <li> <strong>You are <strong>not allowed</strong> to use any internet resources, i.e. no google etc.</strong> </li> - <li> Do not copy or share the questions or answers with anyone until the exam is complete <strong>for everyone</strong>.</li> - <li> <strong>All</strong> your attempts at the questions are logged. Do not try to outsmart and break the testing system. If you do, we know who you are and we will expel you from the course. You have been warned. - </li> - </ul> - <p> We hope you enjoy taking this exam !!!</p> + {{ questionpaper.quiz.instructions|safe }} <div class="row"> <div class="col-md-6"> {% if user == "moderator" %} diff --git a/yaksh/test_models.py b/yaksh/test_models.py index eda2227..522da89 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -46,7 +46,7 @@ def setUpModule(): attempts_allowed=1, time_between_attempts=0, description='demo quiz', pass_criteria=0, language='Python', prerequisite=None, - course=course) + course=course, instructions="Demo Instructions") Quiz.objects.create(start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzinfo=pytz.utc), @@ -56,7 +56,7 @@ def setUpModule(): attempts_allowed=-1, time_between_attempts=0, description='demo quiz', pass_criteria=40, language='Python', prerequisite=quiz, - course=course) + course=course, instructions="Demo Instructions") with open('/tmp/test.txt', 'wb') as f: f.write('2'.encode('ascii')) @@ -239,6 +239,7 @@ class QuizTestCases(unittest.TestCase): self.assertEqual(self.quiz1.language, 'Python') self.assertEqual(self.quiz1.pass_criteria, 0) self.assertEqual(self.quiz1.prerequisite, None) + self.assertEqual(self.quiz1.instructions, "Demo Instructions") def test_is_expired(self): self.assertFalse(self.quiz1.is_expired()) diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 2b7ad9b..30ebcaa 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -1,6 +1,6 @@ from datetime import datetime import pytz - +import os from django.contrib.auth.models import Group from django.core.urlresolvers import reverse from django.test import TestCase @@ -146,7 +146,9 @@ class TestAddQuiz(TestCase): self.mod_group = Group.objects.create(name='moderator') tzone = pytz.timezone('UTC') - + file_path = os.path.join(os.getcwd(), "Quiz_instructions.txt") + with open(file_path, 'r') as file: + self.file_data = file.read() # Create Moderator with profile self.user_plaintext_pass = 'demo' self.user = User.objects.create_user( @@ -185,7 +187,7 @@ class TestAddQuiz(TestCase): self.pre_req_quiz = Quiz.objects.create( start_date_time=datetime(2014, 2, 1, 5, 8, 15, 0, tzone), end_date_time=datetime(2015, 10, 9, 10, 8, 15, 0, tzone), - duration=30, active=True, + duration=30, active=True, instructions=self.file_data, attempts_allowed=-1, time_between_attempts=0, description='pre requisite quiz', pass_criteria=40, language='Python', prerequisite=None, @@ -195,7 +197,7 @@ class TestAddQuiz(TestCase): self.quiz = Quiz.objects.create( start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone), end_date_time=datetime(2015, 10, 9, 10, 8, 15, 0, tzone), - duration=30, active=True, + duration=30, active=True, instructions=self.file_data, attempts_allowed=-1, time_between_attempts=0, description='demo quiz', pass_criteria=40, language='Python', prerequisite=self.pre_req_quiz, @@ -272,6 +274,7 @@ class TestAddQuiz(TestCase): 'description': 'updated demo quiz', 'pass_criteria': 40, 'language': 'java', + 'instructions': self.file_data, 'prerequisite': self.pre_req_quiz.id, 'course': self.course.id } @@ -318,6 +321,7 @@ class TestAddQuiz(TestCase): 'description': 'new demo quiz', 'pass_criteria': 50, 'language': 'python', + 'instructions': self.file_data, 'prerequisite': self.pre_req_quiz.id, 'course': self.course.id } |