From db73441ae5abfdfa0f04d049a1c33a156ab553f4 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Tue, 3 Oct 2017 16:41:52 +0530 Subject: Allow file field and tags field to be skipped altogether in an yaml file --- yaksh/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 787daa6..9603282 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -420,9 +420,11 @@ class Question(models.Model): msg = "Questions Uploaded Successfully" for question in questions: question['user'] = user - file_names = question.pop('files') + file_names = question.pop('files') \ + if 'files' in question \ + else None + tags = question.pop('tags') if 'tags' in question else None test_cases = question.pop('testcase') - tags = question.pop('tags') que, result = Question.objects.get_or_create(**question) if file_names: que._add_files_to_db(file_names, file_path) -- cgit From 1ad1ef1c69cb8208e4d330a9695442b4d78134ac Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Thu, 12 Oct 2017 18:05:11 +0530 Subject: Fix User data UI bug and auto-updates demo course total marks --- yaksh/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 9603282..f7d9906 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -925,7 +925,6 @@ class QuestionPaper(models.Model): def create_demo_quiz_ppr(self, demo_quiz, user): question_paper = QuestionPaper.objects.create(quiz=demo_quiz, - total_marks=6.0, shuffle_questions=False ) summaries = ['Roots of quadratic equation', 'Print Output', @@ -941,6 +940,8 @@ class QuestionPaper(models.Model): question_paper.save() # add fixed set of questions to the question paper question_paper.fixed_questions.add(*questions) + question_paper.update_total_marks() + question_paper.save() def get_ordered_questions(self): ques = [] -- cgit