diff options
author | King | 2018-07-12 14:00:59 -0700 |
---|---|---|
committer | GitHub | 2018-07-12 14:00:59 -0700 |
commit | 661c9d82bb680e745cc6b498131a0793b954c436 (patch) | |
tree | 9982e226f9bf81aaab98d752db3a8aba3de0c631 /yaksh/models.py | |
parent | f61742f04f417cfb60576f9904afd0dc5c537b3c (diff) | |
parent | 714eeb188c67a6b61dfd132f0869e7679d91c8bf (diff) | |
download | online_test-661c9d82bb680e745cc6b498131a0793b954c436.tar.gz online_test-661c9d82bb680e745cc6b498131a0793b954c436.tar.bz2 online_test-661c9d82bb680e745cc6b498131a0793b954c436.zip |
Merge pull request #491 from maheshgudi/catch_compilation_error
Raise appropriate exceptions for C and Java language to the Grader
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index e25fd81..1eca721 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1457,9 +1457,12 @@ class QuestionPaper(models.Model): random.shuffle(testcases) testcases_ids = ",".join([str(tc.id) for tc in testcases] ) - TestCaseOrder.objects.create( - answer_paper=ans_paper, question=question, - order=testcases_ids) + if not TestCaseOrder.objects.filter( + answer_paper=ans_paper, question=question + ).exists(): + TestCaseOrder.objects.create( + answer_paper=ans_paper, question=question, + order=testcases_ids) ans_paper.questions_order = ",".join(question_ids) ans_paper.save() @@ -2297,4 +2300,7 @@ class TestCaseOrder(models.Model): order = models.TextField() + class Meta: + unique_together = ("answer_paper", "question", "order") + ############################################################################## |