forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-80984 gradereport_grader: apply penalty to overridden grade
- Loading branch information
Nathan Nguyen
committed
Dec 17, 2024
1 parent
5695e61
commit 9fd8342
Showing
14 changed files
with
257 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
grade/report/grader/tests/behat/grade_override_with_deduction.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@gradereport @gradereport_grader @gradereport_grader_deduction | ||
Feature: As a teacher, I want to override a grade with a deduction and check the gradebook. | ||
|
||
Background: | ||
Given the following "courses" exist: | ||
| fullname | shortname | format | | ||
| Course 1 | C1 | topics | | ||
And I enable penalty for overridden grade | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
| student1 | Student | 1 | student1@example.com | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
And the following "grade items" exist: | ||
| itemname | grademin | grademax | course | | ||
| Manual grade 01 | 0 | 100 | C1 | | ||
| Manual grade 02 | 0 | 100 | C1 | | ||
And the following "grade grades" exist: | ||
| gradeitem | user | grade | deductedmark | | ||
| Manual grade 01 | student1 | 60 | 10 | | ||
| Manual grade 02 | student1 | 80 | 20 | | ||
When I log in as "teacher1" | ||
|
||
@javascript | ||
Scenario: Override a grade with a deduction and check the gradebook | ||
Given I am on "Course 1" course homepage | ||
And I navigate to "View > Grader report" in the course gradebook | ||
And the following should exist in the "user-grades" table: | ||
| -1- | -2- | -3- | -4- | -5- | | ||
| Student 1 | student1@example.com | 60 | 80 | 140 | | ||
And I turn editing mode on | ||
And I set the following fields to these values: | ||
| Student 1 Manual grade 01 grade | 80 | | ||
| Student 1 Manual grade 01 Penalty exemption | 0 | | ||
| Student 1 Manual grade 02 Penalty exemption | 1 | | ||
And I click on "Save changes" "button" | ||
When I turn editing mode off | ||
Then the following should exist in the "user-grades" table: | ||
| -1- | -2- | -3- | -4- | -5- | | ||
| Student 1 | student1@example.com | 70 | 100 | 170 | | ||
When I turn editing mode on | ||
And I set the following fields to these values: | ||
| Student 1 Manual grade 02 grade | 100 | | ||
| Student 1 Manual grade 02 Penalty exemption | 0 | | ||
And I click on "Save changes" "button" | ||
And I turn editing mode off | ||
Then the following should exist in the "user-grades" table: | ||
| -1- | -2- | -3- | -4- | -5- | | ||
| Student 1 | student1@example.com | 70 | 80 | 150 | |
54 changes: 54 additions & 0 deletions
54
grade/templates/grades/grader/overriden_with_penalty.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{{! | ||
This file is part of Moodle - http://moodle.org/ | ||
Moodle is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Moodle is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
}} | ||
{{! | ||
@template core_grades/grades/grader/overriden_with_penalty | ||
Input template for grader report cell. | ||
Example context (json): | ||
{ | ||
"deductedmark": "30.00", | ||
"effectivegrade": "70.00", | ||
"exemptionid": "exemption3_2", | ||
"exemptionlabel": "Exempt penalty", | ||
"exemptiontooltip": "Exempt penalty", | ||
"exemptionname": "exemption[3][2]", | ||
"penaltyexempted": "true", | ||
"id": "grade_313_624", | ||
"label": "grade_313_624", | ||
"name": "grade[313][624]" | ||
} | ||
}} | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="mr-0">Original grade: </div> | ||
{{>core_grades/grades/grader/input}} | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="mr-0">Current grade: {{{effectivegrade}}}</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="mr-0" title="{{exemptiontooltip}}">Exempt penalty:</div> | ||
<label for="{{exemptionid}}" class="accesshide">{{{exemptionlabel}}}</label> | ||
<input type="checkbox" name="{{exemptionname}}" | ||
value="{{deductedmark}}" id="{{exemptionid}}" | ||
{{#penaltyexempted}}checked{{/penaltyexempted}}> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters