diff options
author | Prabhu Ramachandran | 2017-01-03 18:12:54 +0530 |
---|---|---|
committer | GitHub | 2017-01-03 18:12:54 +0530 |
commit | ef6a61b1938ec399efb6d66b914f245afa3ed5ff (patch) | |
tree | b51ef2de04ecd29c242f527bf12e0570e8a258fd | |
parent | ed79af7d019c96517ea03e13bc2809ea1e8d17c4 (diff) | |
parent | 25eb8d10045e1af6ab7c282b8df0b008223be545 (diff) | |
download | online_test-ef6a61b1938ec399efb6d66b914f245afa3ed5ff.tar.gz online_test-ef6a61b1938ec399efb6d66b914f245afa3ed5ff.tar.bz2 online_test-ef6a61b1938ec399efb6d66b914f245afa3ed5ff.zip |
Merge pull request #173 from maheshgudi/change_instructions
Edit instructions modified and MCQ choices html rendered
-rw-r--r-- | Quiz_instructions.txt | 18 | ||||
-rw-r--r-- | yaksh/forms.py | 53 | ||||
-rw-r--r-- | yaksh/models.py | 6 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/monitor.html | 9 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 4 | ||||
-rw-r--r-- | yaksh/templates/yaksh/user_data.html | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/view_answerpaper.html | 2 | ||||
-rw-r--r-- | yaksh/templatetags/custom_filters.py | 10 | ||||
-rw-r--r-- | yaksh/test_views.py | 11 |
10 files changed, 81 insertions, 36 deletions
diff --git a/Quiz_instructions.txt b/Quiz_instructions.txt deleted file mode 100644 index 34e010f..0000000 --- a/Quiz_instructions.txt +++ /dev/null @@ -1,18 +0,0 @@ -<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/forms.py b/yaksh/forms.py index 6fbaf5d..1d18d29 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -9,6 +9,7 @@ from taggit.managers import TaggableManager from taggit.forms import TagField from django.forms.models import inlineformset_factory from django.db.models import Q +from textwrap import dedent try: from string import letters except ImportError: @@ -165,6 +166,58 @@ class QuizForm(forms.ModelForm): self.fields['prerequisite'].required = False self.fields['course'] = forms.ModelChoiceField( queryset=Course.objects.filter(id=course_id), empty_label=None) + self.fields["instructions"].initial = dedent("""\ + <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 not allowed + 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> + """) class Meta: model = Quiz diff --git a/yaksh/models.py b/yaksh/models.py index 2bf4a85..04bdd24 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -81,10 +81,6 @@ 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): @@ -550,7 +546,7 @@ class Quiz(models.Model): is_trial = models.BooleanField(default=False) instructions = models.TextField('Instructions for Students', - default=get_quiz_instructions_info) + default=None, blank=True, null=True) view_answerpaper = models.BooleanField('Allow student to view their answer\ paper', default=False) diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 6fb8187..ec8c244 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -130,7 +130,7 @@ Status : <b style="color: green;"> Passed </b><br/> {% if question.type == "mcq" or question.type == "mcc" %} <h5> <u>Choices:</u></h5> {% for testcase in question.get_test_cases %} - <br/><strong>{{ forloop.counter }}. {{ testcase.options }}</strong> + <br/><strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong> {% endfor %} {% else %} <h5> <u>Test cases: </u></h5> diff --git a/yaksh/templates/yaksh/monitor.html b/yaksh/templates/yaksh/monitor.html index 7a3297b..0ad6401 100644 --- a/yaksh/templates/yaksh/monitor.html +++ b/yaksh/templates/yaksh/monitor.html @@ -1,4 +1,5 @@ {% extends "manage.html" %} +{% load custom_filters %} {% block pagetitle %} Quiz results {% endblock pagetitle %} @@ -49,6 +50,14 @@ $(document).ready(function() {% if papers %} <p>Number of papers: {{ papers|length }} </p> +{% completed papers as completed_papers %} + {# template tag used to get the count of completed papers #} + <p>Papers completed: <b> {{ completed_papers }} </b></p> + +{% inprogress papers as inprogress_papers %} + {# template tag used to get the count of inprogress papers #} + <p>Papers in progress:<b> {{ inprogress_papers }} </b></p> + <p><a href="{{URL_ROOT}}/exam/manage/statistics/question/{{papers.0.question_paper.id}}">Question Statisitics</a></p> <p><a href="{{URL_ROOT}}/exam/manage/monitor/download_csv/{{papers.0.question_paper.id}}">Download CSV</a></p> <table id="result-table" class="tablesorter table"> diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 8b2012c..ba64b63 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -173,7 +173,7 @@ function call_skip(url) </p> {% endif %} {% for test_case in test_cases %} - <input name="answer" type="radio" value="{{ test_case.options }}" />{{ test_case.options }} <br/> + <input name="answer" type="radio" value="{{ test_case.options }}" />{{ test_case.options|safe }} <br/> {% endfor %} {% endif %} {% if question.type == "mcc" %} @@ -189,7 +189,7 @@ function call_skip(url) </p> {% endif %} {% for test_case in test_cases %} - <input name="answer" type="checkbox" value="{{ test_case.options }}"> {{ test_case.options }} + <input name="answer" type="checkbox" value="{{ test_case.options }}"> {{ test_case.options|safe }} <br> {% endfor %} {% endif %} diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index 856433d..9c11dd9 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -66,7 +66,7 @@ User IP address: {{ paper.user_ip }} {% if question.type == "mcq" or question.type == "mcc" %} <h5> <u>Choices:</u></h5> {% for testcase in question.get_test_cases %} - <br/><strong>{{ forloop.counter }}. {{ testcase.options }}</strong> + <br/><strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong> {% endfor %} {% else %} <h5> <u>Test cases: </u></h5> diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 9dfbda0..8dec5b3 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -42,7 +42,7 @@ {% if question.type == "mcq" or question.type == "mcc" %} <h5> <u>Choices:</u></h5> {% for testcase in question.get_test_cases %} - <br/><strong>{{ forloop.counter }}. {{ testcase.options }}</strong> + <br/><strong>{{ forloop.counter }}. {{ testcase.options|safe }}</strong> {% endfor %} {%endif%} diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py index 9d7b939..f610cc6 100644 --- a/yaksh/templatetags/custom_filters.py +++ b/yaksh/templatetags/custom_filters.py @@ -10,4 +10,12 @@ def escape_quotes(value): escape_single_quotes = value.replace("'", "\\'") escape_single_and_double_quotes = escape_single_quotes.replace('"', '\\"') - return escape_single_and_double_quotes
\ No newline at end of file + return escape_single_and_double_quotes + +@register.assignment_tag(name="completed") +def completed(answerpaper): + return answerpaper.filter(status="completed").count() + +@register.assignment_tag(name="inprogress") +def inprogress(answerpaper): + return answerpaper.filter(status="inprogress").count() diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 2419591..e052441 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -146,9 +146,6 @@ 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( @@ -187,7 +184,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, instructions=self.file_data, + duration=30, active=True, instructions="Demo Instructions", attempts_allowed=-1, time_between_attempts=0, description='pre requisite quiz', pass_criteria=40, language='Python', prerequisite=None, @@ -197,7 +194,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, instructions=self.file_data, + duration=30, active=True, instructions="Demo Instructions", attempts_allowed=-1, time_between_attempts=0, description='demo quiz', pass_criteria=40, language='Python', prerequisite=self.pre_req_quiz, @@ -274,7 +271,7 @@ class TestAddQuiz(TestCase): 'description': 'updated demo quiz', 'pass_criteria': 40, 'language': 'java', - 'instructions': self.file_data, + 'instructions': "Demo Instructions", 'prerequisite': self.pre_req_quiz.id, 'course': self.course.id } @@ -321,7 +318,7 @@ class TestAddQuiz(TestCase): 'description': 'new demo quiz', 'pass_criteria': 50, 'language': 'python', - 'instructions': self.file_data, + 'instructions': "Demo Instructions", 'prerequisite': self.pre_req_quiz.id, 'course': self.course.id } |