diff options
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index dc12707..7fae305 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)] @@ -1129,10 +1130,11 @@ 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) - 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, @@ -1145,9 +1147,9 @@ class StandardTestCase(TestCase): class StdioBasedTestCase(TestCase): - expected_input = models.TextField(blank=True) - expected_output = models.TextField() - weight = models.IntegerField(default=0.0) + expected_input = models.CharField(max_length=100, blank=True) + expected_output = models.CharField(max_length=100) + weight = models.IntegerField(default=1.0) def get_field_value(self): return {"expected_output": self.expected_output, @@ -1161,7 +1163,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): @@ -1171,3 +1173,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=1.0) |