-
Notifications
You must be signed in to change notification settings - Fork 4
Autopopulate grade ranged rubric #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // 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/>. | ||
|
|
||
| /** | ||
| * Modify ranged rubric grading form. | ||
| * | ||
| * @author Sumaiya Javed <sumaiya.javed@catalyst.net.nz | ||
| * @copyright Catalyst IT | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing year, presumably this should be: |
||
| * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
| */ | ||
|
|
||
| define([], function() { | ||
| return { | ||
| init: function(gdata) { | ||
| if (gdata) { | ||
| const rows = Object.values(gdata); | ||
| rows.forEach(function(row) { | ||
| const elementName = "advancedgrading-criteria-" + row.criterionid; | ||
| const elementLevel = document.getElementById(elementName + "-levels-" + row.avglevel); | ||
| if (elementLevel) { | ||
| elementLevel.classList.add('checked'); | ||
| } | ||
| const elementDefinition = document.getElementById(elementName + "-levels-" + row.avglevel + "-definition"); | ||
| if (elementDefinition) { | ||
| elementDefinition.checked = true; | ||
| } | ||
| const elementGrade = document.getElementById(elementName + "-grade"); | ||
| if (elementGrade) { | ||
| elementGrade.value = row.avggrade; | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| }; | ||
| }); | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -136,6 +136,15 @@ protected function new_feedback() { | |||||
| $urlparams['stageidentifier'] = $teacherfeedback->stageidentifier; | ||||||
| $PAGE->set_url('/mod/coursework/actions/feedbacks/new.php', $urlparams); | ||||||
|
|
||||||
| // Autopopulate average grade from initial assessors. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given this relates to non-core functionality I think this comment should explicitly mention the plugin in this comment, for example: |
||||||
| if ($coursework && $coursework->is_using_ranged_rubric() && $teacherfeedback->stageidentifier == 'final_agreed_1') { | ||||||
| if (str_contains($coursework->automaticagreementstrategy, 'none')) { | ||||||
|
||||||
| if (str_contains($coursework->automaticagreementstrategy, 'none')) { | |
| if ($coursework->automaticagreementstrategy === 'none') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than:
if (...) {
if (...) {
⋮
}
}
why not have a single if condition:
if ($coursework && $coursework->is_using_ranged_rubric()
&& $teacherfeedback->stageidentifier == 'final_agreed_1'
&& $coursework->automaticagreementstrategy === 'none') {
) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed. Why bother initialising $gdata when it's assigned on the next line?
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2119,7 +2119,23 @@ public function get_advanced_grading_active_controller() { | |||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * @return grading_manager | ||||||
| * @return bool|gradingform_controller|null | ||||||
|
||||||
| * @return bool|gradingform_controller|null | |
| * @return array|false|null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check $submissionid here ? Could this actually be a falsy value? (Maybe it could but from a quick skim of the code I couldn't see how).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses NOT LIKE but the compared value doesn't contain a wildcard. Presumably this should be:
WHERE cf.submissionid = :submissionid AND cf.stageidentifier <> 'final_agreed_1' AND cf.finalised = 1 AND gi.status = 1
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space in ORDER BY clause. Remove the extra space between 'ORDER' and 'BY' for consistency with SQL formatting standards.
| GROUP BY rr.criterionid ORDER BY rr.criterionid "; | |
| GROUP BY rr.criterionid ORDER BY rr.criterionid "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If if ($submissionid) {} is false then nothing is returned, won't that break the caller? Should we have return false here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, since this relates to non-core functionality I think this comment should explicitly mention the plugin. For example:
* Check if ranged rubric (gradingform_rubric_ranges) is used in the
* current coursework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing closing angle bracket in email address. The author tag should end with '>' after the email address.