From cb9d4c01d6287ab1288d0755d4f93d5320eb1d3a Mon Sep 17 00:00:00 2001 From: prathamesh Date: Wed, 7 Dec 2016 13:50:33 +0530 Subject: basic interface to add multiple testcases to a question --- yaksh/models.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 2018198..7a64bba 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -53,6 +53,7 @@ test_case_types = ( ("standardtestcase", "Standard Testcase"), ("stdiobasedtestcase", "StdIO Based Testcase"), ("mcqtestcase", "MCQ Testcase"), + ("hooktestcase", "Hook Testcase"), ) attempts = [(i, i) for i in range(1, 6)] @@ -1122,9 +1123,10 @@ class AssignmentUpload(models.Model): ################################################################################ class TestCase(models.Model): question = models.ForeignKey(Question, blank=True, null = True) + type = models.CharField(max_length=24, choices=test_case_types, null=True) class StandardTestCase(TestCase): - test_case = models.TextField(blank=True) + test_case = models.CharField(blank=True, max_length=100) weight = models.FloatField(default=0.0) def get_field_value(self): @@ -1138,8 +1140,8 @@ class StandardTestCase(TestCase): class StdioBasedTestCase(TestCase): - expected_input = models.TextField(blank=True) - expected_output = models.TextField() + expected_input = models.CharField(max_length=100, blank=True) + expected_output = models.CharField(max_length=100) weight = models.IntegerField(default=0.0) def get_field_value(self): @@ -1154,7 +1156,7 @@ class StdioBasedTestCase(TestCase): class McqTestCase(TestCase): - options = models.TextField() + options = models.CharField(max_length=100) correct = models.BooleanField(default=False) def get_field_value(self): @@ -1164,3 +1166,8 @@ class McqTestCase(TestCase): return u'Question: {0} | Correct: {1}'.format(self.question, self.correct ) + + +class HookTestCase(TestCase): + code = models.TextField() + weight = models.FloatField(default=0.0) -- cgit From e436ec35a4086a16208e30e1384ca0ebc8082570 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Mon, 19 Dec 2016 06:35:00 +0530 Subject: change in add question interface --- yaksh/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 7a64bba..77e77ee 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1126,8 +1126,8 @@ class TestCase(models.Model): type = models.CharField(max_length=24, choices=test_case_types, null=True) class StandardTestCase(TestCase): - test_case = models.CharField(blank=True, max_length=100) - weight = models.FloatField(default=0.0) + test_case = models.TextField() + weight = models.FloatField(default=1.0) def get_field_value(self): return {"test_case": self.test_case, @@ -1142,7 +1142,7 @@ class StandardTestCase(TestCase): class StdioBasedTestCase(TestCase): expected_input = models.CharField(max_length=100, blank=True) expected_output = models.CharField(max_length=100) - weight = models.IntegerField(default=0.0) + weight = models.IntegerField(default=1.0) def get_field_value(self): return {"expected_output": self.expected_output, @@ -1170,4 +1170,4 @@ class McqTestCase(TestCase): class HookTestCase(TestCase): code = models.TextField() - weight = models.FloatField(default=0.0) + weight = models.FloatField(default=1.0) -- cgit