Make StringyInteger and StringyFloat return None when they can't parse the string from json, and don't try to overwrite max_attempts if it's ''
This commit is contained in:
@@ -32,7 +32,7 @@ class StringyInteger(Integer):
|
||||
try:
|
||||
return int(value)
|
||||
except:
|
||||
return value
|
||||
return None
|
||||
|
||||
|
||||
class StringyFloat(Float):
|
||||
@@ -43,7 +43,7 @@ class StringyFloat(Float):
|
||||
try:
|
||||
return float(value)
|
||||
except:
|
||||
return value
|
||||
return None
|
||||
|
||||
|
||||
# Generated this many different variants of problems with rerandomize=per_student
|
||||
@@ -140,9 +140,6 @@ class CapaModule(CapaFields, XModule):
|
||||
# see comment on randomization_bin
|
||||
self.seed = randomization_bin(system.seed, self.location.url)
|
||||
|
||||
if self.max_attempts == '':
|
||||
self.max_attempts = None
|
||||
|
||||
# Need the problem location in openendedresponse to send out. Adding
|
||||
# it to the system here seems like the least clunky way to get it
|
||||
# there.
|
||||
@@ -391,7 +388,7 @@ class CapaModule(CapaFields, XModule):
|
||||
|
||||
content = {'name': self.display_name_with_default,
|
||||
'html': html,
|
||||
'weight': self.descriptor.weight,
|
||||
'weight': self.weight,
|
||||
}
|
||||
|
||||
context = {'problem': content,
|
||||
|
||||
Reference in New Issue
Block a user