cleaning up answer parsing for free form fields
parent
79ba0cfdb6
commit
000431b208
|
@ -986,6 +986,8 @@ def dep_check(expr, runinfo, answerdict):
|
||||||
|
|
||||||
if actual_answer is None:
|
if actual_answer is None:
|
||||||
actual_answer = u''
|
actual_answer = u''
|
||||||
|
if type(actual_answer) == type(list()):
|
||||||
|
actual_answer = actual_answer[0]
|
||||||
if check_answer[0:1] in "<>":
|
if check_answer[0:1] in "<>":
|
||||||
try:
|
try:
|
||||||
actual_answer = float(actual_answer)
|
actual_answer = float(actual_answer)
|
||||||
|
@ -1004,13 +1006,10 @@ def dep_check(expr, runinfo, answerdict):
|
||||||
return actual_answer < check_value
|
return actual_answer < check_value
|
||||||
if check_answer.startswith(">"):
|
if check_answer.startswith(">"):
|
||||||
return actual_answer > check_value
|
return actual_answer > check_value
|
||||||
if type(actual_answer) == type(list()):
|
|
||||||
actual_answer = actual_answer[0]
|
|
||||||
if check_answer.startswith("!"):
|
if check_answer.startswith("!"):
|
||||||
if actual_answer == '':
|
if actual_answer == '':
|
||||||
return False
|
return False
|
||||||
return check_answer[1:].strip() != actual_answer.strip()
|
return check_answer[1:].strip() != actual_answer.strip()
|
||||||
|
|
||||||
return check_answer.strip() == actual_answer.strip()
|
return check_answer.strip() == actual_answer.strip()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue