Commit e4831015 by Alan Boudreault

No more need to cast with the enforce_type in XBlock

parent 83b2f7b4
...@@ -116,15 +116,6 @@ class MentoringBlock(XBlockWithLightChildren): ...@@ -116,15 +116,6 @@ class MentoringBlock(XBlockWithLightChildren):
log.info(u'Received submissions: {}'.format(submissions)) log.info(u'Received submissions: {}'.format(submissions))
self.attempted = True self.attempted = True
# TODO Don't do that...
# The xblock.fields.Field implementation has the effect that if the data *is not* read from
# the json (real xblock), it is set as dirty and it doesn't take care of the data type. So
# self.max_attempts is a string since it is read from the xml and set using 'setattr'.
try:
max_attempts = int(self.max_attempts)
except ValueError:
max_attempts = 0
submit_results = [] submit_results = []
completed = True completed = True
for child in self.get_children_objects(): for child in self.get_children_objects():
...@@ -159,7 +150,7 @@ class MentoringBlock(XBlockWithLightChildren): ...@@ -159,7 +150,7 @@ class MentoringBlock(XBlockWithLightChildren):
self.completed = bool(completed) self.completed = bool(completed)
if not self.completed and max_attempts > 0: if not self.completed and self.max_attempts > 0:
self.num_attempts += 1 self.num_attempts += 1
return { return {
...@@ -167,7 +158,7 @@ class MentoringBlock(XBlockWithLightChildren): ...@@ -167,7 +158,7 @@ class MentoringBlock(XBlockWithLightChildren):
'completed': self.completed, 'completed': self.completed,
'attempted': self.attempted, 'attempted': self.attempted,
'message': message, 'message': message,
'max_attempts': max_attempts, 'max_attempts': self.max_attempts,
'num_attempts': self.num_attempts 'num_attempts': self.num_attempts
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment