summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authormaheshgudi2017-02-08 17:48:55 +0530
committermaheshgudi2017-03-02 20:38:41 +0530
commit23018fa38afcdfec93f1338bd783a769a0fe91e7 (patch)
tree2256d73148791118fb3624e7b78a5e371d2a70f1 /yaksh/models.py
parent321343d45bc1f4d20cd348773bd8b214d9c4d692 (diff)
downloadonline_test-23018fa38afcdfec93f1338bd783a769a0fe91e7.tar.gz
online_test-23018fa38afcdfec93f1338bd783a769a0fe91e7.tar.bz2
online_test-23018fa38afcdfec93f1338bd783a769a0fe91e7.zip
changed string check names
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py14
1 files changed, 6 insertions, 8 deletions
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']