Commit 83b2f7b4 by Alan Boudreault

various minor fix

parent 347af2e6
...@@ -160,7 +160,7 @@ class MentoringBlock(XBlockWithLightChildren): ...@@ -160,7 +160,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 max_attempts > 0:
setattr(self, 'num_attempts', self.num_attempts + 1) self.num_attempts += 1
return { return {
'submitResults': submit_results, 'submitResults': submit_results,
......
...@@ -143,12 +143,12 @@ function MentoringBlock(runtime, element) { ...@@ -143,12 +143,12 @@ function MentoringBlock(runtime, element) {
// validate all children // validate all children
function validateXBlock() { function validateXBlock() {
var submit_dom = $(element).find('.submit .input-main'); var submit_dom = $(element).find('.submit .input-main');
var children_are_valid = true; var is_valid = true;
var data = $('.attempts', element).data(); var data = $('.attempts', element).data();
var children = getChildren(element); var children = getChildren(element);
if ((data.max_attempts > 0) && (data.num_attempts >= data.max_attempts)) { if ((data.max_attempts > 0) && (data.num_attempts >= data.max_attempts)) {
children_are_valid = false; is_valid = false;
} }
else { else {
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {
...@@ -156,13 +156,13 @@ function MentoringBlock(runtime, element) { ...@@ -156,13 +156,13 @@ function MentoringBlock(runtime, element) {
if (child.name !== undefined) { if (child.name !== undefined) {
var child_validation = callIfExists(child, 'validate'); var child_validation = callIfExists(child, 'validate');
if (_.isBoolean(child_validation)) { if (_.isBoolean(child_validation)) {
children_are_valid = children_are_valid && child_validation is_valid = is_valid && child_validation;
} }
} }
} }
} }
if (!children_are_valid) { if (!is_valid) {
submit_dom.attr('disabled','disabled'); submit_dom.attr('disabled','disabled');
} }
else { else {
......
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