Fix points i18n on Add Group dialog

Test Plan:
- Create a bank with at least one question
- Set the course language to french (or similar locale with localized
  numbers)
- Create a new quiz
- Click "Find Question" (the third button with a magnifying glass)
- Select the existing bank and select "[New Group]" (the last item in
  the drop down)
- in the new dialog that appears, enter localized points, like `1,5` or
  similar
- expect it to save correctly

Closes QO-517

Change-Id: Ia87e451ec066da3fd1ac6a6db5aaceb816d18f5b
Reviewed-on: https://gerrit.instructure.com/211645
Tested-by: Jenkins
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Kevin Dougherty III <jdougherty@instructure.com>
This commit is contained in:
Aaron Griffin 2019-10-01 12:28:06 -05:00
parent 20eb48765a
commit 03c1cefb53
1 changed files with 8 additions and 0 deletions

View File

@ -2719,6 +2719,14 @@ const lockedItems = lockManager.isChildContent() ? lockManager.getItemLocks() :
$dialog.find("button").attr('disabled', true).filter(".submit_button").text(I18n.t('buttons.creating_group', "Creating Group..."));
var params = $dialog.getFormData();
var quizGroupQuestionPoints = numberHelper.parse(params['quiz_group[question_points]']);
if (quizGroupQuestionPoints && quizGroupQuestionPoints < 0) {
$(this).find("input[name='quiz_group[question_points]']").errorBox(I18n.t('question.positive_points', "Must be zero or greater"));
return false;
} else {
params['quiz_group[question_points]'] = quizGroupQuestionPoints;
}
var newParams = {};
_.each(params, (val, key) => {
newParams[key.replace('quiz_group[', 'quiz_groups[][')] = val;