From 9e23f5d7b8fa6641bffc6ff748ce6fe49b10b36e Mon Sep 17 00:00:00 2001 From: Mikhail Golenkov Date: Mon, 5 Oct 2020 14:56:58 +1100 Subject: [PATCH] MDL-69791 gradereport: Fix error message when invalid grade is entered --- grade/report/grader/module.js | 2 +- .../report/grader/tests/behat/ajax_grader.feature | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/grade/report/grader/module.js b/grade/report/grader/module.js index 46d51dba0c9..4f60c574c5d 100644 --- a/grade/report/grader/module.js +++ b/grade/report/grader/module.js @@ -569,7 +569,7 @@ M.gradereport_grader.classes.ajax.prototype.submission_outcome = function(tid, o var p = args.properties; if (args.type == 'grade') { var oldgrade = args.values.oldgrade; - p.cell.one('.gradevalue').set('innerHTML',oldgrade); + p.cell.one('input.text').set('value', oldgrade); } else if (args.type == 'feedback') { this.report.update_feedback(p.userid, p.itemid, args.values.oldfeedback); } diff --git a/grade/report/grader/tests/behat/ajax_grader.feature b/grade/report/grader/tests/behat/ajax_grader.feature index b7cbe9e6fb8..358f9a5e276 100644 --- a/grade/report/grader/tests/behat/ajax_grader.feature +++ b/grade/report/grader/tests/behat/ajax_grader.feature @@ -234,3 +234,18 @@ Feature: Using the AJAX grading feature of Grader report to update grades and fe | Student 2 | 10.00 | 30.00 | 20.00 | 5.00 | 45.00 | 110.00 | 110.00 | And I click on student "Student 2" for grade item "Item 1" And the field "ajaxfeedback" matches value "Some feedback" + + @javascript + Scenario: Teacher can see an error when an incorrect grade is given using the grader report with editing and AJAX on + Given I log in as "teacher1" + And I am on "Course 1" course homepage + And I navigate to "View > Grader report" in the course gradebook + And I turn editing mode on + And I give the grade "66.00" to the user "Student 2" for the grade item "Item VU" + And I click away from student "Student 2" and grade item "Item VU" value + When I give the grade "999.00" to the user "Student 2" for the grade item "Item VU" + And I click away from student "Student 2" and grade item "Item VU" value + Then I should see "The grade entered for Item VU for Student 2 is more than the maximum allowed" + And I click on "The grade entered for Item VU for Student 2 is more than the maximum allowed" "text" + And I should not see "The grade entered for Item VU for Student 2 is more than the maximum allowed" + And the grade for "Student 2" in grade item "Item VU" should match "66.00"