diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/forms.py | 2 | ||||
-rw-r--r-- | yaksh/models.py | 14 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index fdc881f..c6283c8 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -37,7 +37,7 @@ question_types = ( ("upload", "Assignment Upload"), ("integer", "Answer in Integer"), ("string", "Answer in String"), - ("float", "Answer in Decimal"), + ("float", "Answer in Float"), ) test_case_types = ( diff --git a/yaksh/models.py b/yaksh/models.py index 12c4a1c..665805e 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -42,7 +42,7 @@ question_types = ( ("upload", "Assignment Upload"), ("integer", "Answer in Integer"), ("string", "Answer in String"), - ("float", "Answer in Decimal"), + ("float", "Answer in Float"), ) enrollment_methods = ( @@ -61,8 +61,8 @@ test_case_types = ( ) string_check_type = ( - ("lower", "Lower case Checking"), - ("exact", "Exact case String Checking"), + ("lower", "Case Insensitive"), + ("exact", "Case Sensitive"), ) attempts = [(i, i) for i in range(1, 6)] @@ -1154,19 +1154,17 @@ class AnswerPaper(models.Model): elif question.type == 'string': testcase = question.get_test_case() if testcase.string_check == "lower": - if testcase.correct.lower() == user_answer.lower(): + if testcase.correct.lower().splitlines() == user_answer.lower().splitlines(): result['success'] = True result['error'] = ['Correct answer'] else: - if testcase.correct == user_answer: + if testcase.correct.splitlines() == user_answer.splitlines(): result['success'] = True result['error'] = ['Correct answer'] elif question.type == 'float': testcase = question.get_test_case() - if testcase.correct-testcase.error_margin\ - <= float(user_answer)\ - <= testcase.correct+testcase.error_margin: + if abs(testcase.correct-user_answer) <= testcase.error_margin: result['success'] = True result['error'] = ['Correct answer'] diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 161db5a..930c57d 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -154,7 +154,7 @@ function call_skip(url) {% elif question.type == "string" %} (ANSWER IN STRING) {% elif question.type == "float" %} - (ANSWER IN DECIMAL) + (ANSWER IN FLOAT) {% endif %} </u> <font class=pull-right>(Marks : {{ question.points }}) </font> |