From d3d114f01adff6176460ba073d7dd44f5217ee00 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Tue, 3 Jan 2017 15:10:05 +0530 Subject: modified editing instructions. Instructions are now initialized in forms and not fetched from a file --- yaksh/forms.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ yaksh/models.py | 6 +----- yaksh/test_views.py | 11 ++++------- 3 files changed, 58 insertions(+), 12 deletions(-) (limited to 'yaksh') 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("""\ +
+ 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. +
++ Here are some important + instructions and rules that you + should understand carefully.
++ We hope you enjoy taking this + exam !!! +
+ """) 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/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 } -- cgit From feeb605573357fd8056f103b1043e192838bb23d Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Tue, 3 Jan 2017 15:21:30 +0530 Subject: MCQ/MCC choices HTML tags are rendered. --- yaksh/templates/yaksh/grade_user.html | 2 +- yaksh/templates/yaksh/question.html | 4 ++-- yaksh/templates/yaksh/user_data.html | 2 +- yaksh/templates/yaksh/view_answerpaper.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'yaksh') 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 : PassedNumber of papers: {{ papers|length }}
+{% completed papers as completed_papers %} + {# template tag used to get the count of completed papers #} +Papers completed: {{ completed_papers }}
+ +{% inprogress papers as inprogress_papers %} + {# template tag used to get the count of inprogress papers #} +Papers in progress: {{ inprogress_papers }}
+