Skip to content

Now checks if max score is 0 or not#1038

Closed
AndrewMRPI wants to merge 9 commits intomasterfrom
validate_admin_gradeable_part2
Closed

Now checks if max score is 0 or not#1038
AndrewMRPI wants to merge 9 commits intomasterfrom
validate_admin_gradeable_part2

Conversation

@AndrewMRPI
Copy link
Contributor

closes #1037

@bmcutler bmcutler requested a review from wangj35 June 9, 2017 14:29
Copy link
Contributor

@wangj35 wangj35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • alert box appears whenever a max score 0 is attempted
  • code looks good as well, I would just move the location of the fix so it's more similar to the rest of the checkForm function

alert("Max score cannot be 0 [Question "+ numOfNumeric + "]");
return false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the way the rest of this function is formatted, I think it'd make more sense if the checking for a max 0 entry were under an if(check3) statement.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd actually want to wrap the for loop with check3 around all of it since it's used in all if statements statically.

if (check3) {
    for (var i = 0; i < $('#numeric_num-items').val(); i++) {
        ...
    }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I meant.


<div class="modal-body" style="/*padding-bottom:80px;*/ overflow:visible;">
What is the unique id of this gradeable? (e.g., <kbd>hw01</kbd>, <kbd>lab_12</kbd>, or <kbd>midterm</kbd>): <input style='width: 200px' type='text' name='gradeable_id' class="required" value="{$gradeable_submission_id}" placeholder="(Required)"/>
What is the unique id of this gradeable? (e.g., <kbd>hw01</kbd>, <kbd>lab_12</kbd>, or <kbd>midterm</kbd>): <input style='width: 200px' type='text' name='gradeable_id' id="gradeable_id" class="required" value="{$gradeable_submission_id}" placeholder="(Required)"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input (and any inputs that cannot be empty) would probably benefit from having the HTML Required attribute.


var numOfNumeric = 0;
var wrapper = $('.numerics-table');
var i;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the var inside the for loop for this variable as we're not using i outside of the loop.

(for (var i = 0; i < $('#numeric_num-items').val(); i++) {)

alert("Max score cannot be 0 [Question "+ numOfNumeric + "]");
return false;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd actually want to wrap the for loop with check3 around all of it since it's used in all if statements statically.

if (check3) {
    for (var i = 0; i < $('#numeric_num-items').val(); i++) {
        ...
    }
}

@AndrewMRPI AndrewMRPI closed this Jun 21, 2017
@AndrewMRPI AndrewMRPI deleted the validate_admin_gradeable_part2 branch June 21, 2017 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Numeric entry's max score to 0 in the form of gradeable can cause errors

4 participants