summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authormaheshgudi2016-07-05 17:50:31 +0530
committermaheshgudi2016-07-05 17:50:31 +0530
commit9c61c84194e6b52913dfc284765a7b7bd77201ad (patch)
tree384f452958efad8cbc1cdc1a518f6fc2c09087e9 /yaksh/models.py
parent1276c2840c3c7f7521c98574dea302160611f79d (diff)
downloadonline_test-9c61c84194e6b52913dfc284765a7b7bd77201ad.tar.gz
online_test-9c61c84194e6b52913dfc284765a7b7bd77201ad.tar.bz2
online_test-9c61c84194e6b52913dfc284765a7b7bd77201ad.zip
will not create trial paper object if the quiz has expired or is inactive
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index f1b0d33..bfe204c 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -303,7 +303,7 @@ class QuizManager(models.Manager):
"""Creates a trial quiz for testing questions"""
trial_quiz = self.create(course=trial_course,
duration=1000,
- description="trial_quiz",
+ description="trial_questions",
is_trial=True,
time_between_attempts=0
)
@@ -311,9 +311,11 @@ class QuizManager(models.Manager):
def create_trial_from_quiz(self, original_quiz_id, user, godmode):
"""Creates a trial quiz from existing quiz"""
- trial_quiz_name = "trial_orig_id_{0}".format(original_quiz_id)
+ trial_quiz_name = "Trial_orig_id_{0}_{1}".format(original_quiz_id,
+ "godmode" if godmode else "usermode"
+ )
- if self.filter(description=trial_quiz_name).exists() and not godmode:
+ if self.filter(description=trial_quiz_name).exists():
trial_quiz = self.get(description=trial_quiz_name)
else: