CTP-5899: Add internal markers comment to agreed grade page. - #309
CTP-5899: Add internal markers comment to agreed grade page.#309cwarwicker wants to merge 1 commit into
Conversation
|
The XMLDB editor fixed some whitespace stuff in the install.xml as well, when I added new fields. |
There was a problem hiding this comment.
Pull request overview
Adds an internal “marker notes” field intended for the final agreed grading stage, backed by new DB columns on coursework_feedbacks, and wires it into the feedback edit form/controller flow.
Changes:
- Bumps plugin version and adds an English language string for the new internal notes label.
- Adds
internalcomment/internalcommentformatcolumns tocoursework_feedbacksvia install + upgrade steps. - Adds form/controller/model support to edit and persist the internal notes (agreement stage).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| version.php | Plugin version bump to trigger upgrade. |
| lang/en/coursework.php | Adds label text for the internal marker notes editor. |
| db/upgrade.php | Adds new feedback columns during upgrade (needs NOT NULL + backup/restore follow-up). |
| db/install.xml | Adds new feedback columns for fresh installs (needs NOT NULL alignment). |
| classes/models/feedback.php | Introduces new model properties for internal notes (needs safe initialisation). |
| classes/forms/assessor_feedback_mform.php | Adds the internal notes editor on the final agreed stage and saves submitted values. |
| classes/controllers/feedback_controller.php | Prepares internal notes editor data for editing (needs safe format fallback). |
Suppressed comments (1)
classes/models/feedback.php:179
$internalcommentformatis a non-nullable typed property without a default. If the DB value is NULL (possible with the current schema/upgrade),apply_data()will not assign it and accessing it will fatally error. Initialise it to a sensible default (e.g.FORMAT_HTML) to matchfeedbackcommentformat.
/**
* @var int Format of the internal comment.
*/
public int $internalcommentformat;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
classes/controllers/feedback_controller.php:235
- This unconditionally reads
$teacherfeedback->internalcomment/internalcommentformat. Becausetable_base::apply_data()skips NULL values (isset()check), either property can be uninitialised and this can fatal when editing existing feedback rows created before the new columns were populated. Useisset()guards and fall back to sane defaults when constructing the editor array.
$teacherfeedback->internalcomment = [
'text' => $teacherfeedback->internalcomment,
'format' => $teacherfeedback->internalcommentformat,
];
classes/models/feedback.php:175
table_base::apply_data()only assigns columns whenisset($data[$columnname])is true, so a NULLinternalcommentDB value leaves this typed property uninitialised. Any read (e.g. in the controller) can then fatal with "Typed property ... must not be accessed before initialization". Initialise the property (and giveinternalcommentformata default) so they are always safe to read.
/**
* @var mixed Internal comment, not visible to student.
*/
public mixed $internalcomment;
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
db/upgrade.php:417
- The new
coursework_feedbacks.internalcommentdata is user-related free-text, but the plugin privacy provider does not declare or export it (seeclasses/privacy/provider.phpwherefeedbackcommentis included butinternalcommentis not). This makes the privacy metadata/export incomplete after this schema change; please update the privacy provider metadata and export formatting to includeinternalcomment(and its format where appropriate), plus any needed language strings.
// Define field internalcomment to be added to coursework_feedbacks.
$table = new xmldb_table('coursework_feedbacks');
$field = new xmldb_field('internalcomment', XMLDB_TYPE_TEXT, null, null, null, null, null, 'finalised');
// Conditionally launch add field internalcomment.
classes/forms/assessor_feedback_mform.php:196
- This introduces a new editor field (
internalcomment) and persistence logic for the final agreed stage, but there is no automated coverage ensuring it appears only forfinal_agreed_1, saves correctly, and is not shown to students. There are existing Behat scenarios coveringfeedbackcommentediting (e.g.tests/behat/feedback_single_marking.feature); adding a similar scenario forinternalcommentwould prevent regressions.
// Is this the agreement stage?
if ($this->feedback->get_stage()->identifier() === final_agreed::STAGE_FINAL_AGREED_1) {
$this->_form->addElement('editor', 'internalcomment', get_string('internalcomments', 'mod_coursework'));
$this->_form->setType('internalcomment', PARAM_RAW);
}
This is only visible on this page, and never by the student.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
db/upgrade.php:424
- New persistent fields
internalcomment/internalcommentformatare added tocoursework_feedbacks, but the plugin’s GDPR/privacy provider does not describe or export this data.classes/privacy/provider.phponly declares/exportsfeedbackcomment(e.g. get_metadata() and format_submissions_feedback()) sointernalcommentwill be omitted from user data export and the metadata registry will be incomplete.
if ($oldversion < 2026070602) {
// Define field internalcomment to be added to coursework_feedbacks.
$table = new xmldb_table('coursework_feedbacks');
$field = new xmldb_field('internalcomment', XMLDB_TYPE_TEXT, null, null, null, null, null, 'finalised');
// Conditionally launch add field internalcomment.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('internalcommentformat', XMLDB_TYPE_INTEGER, 1, null, true, null, 1, 'internalcomment');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
| $this->_form->addElement('editor', 'internalcomment', get_string('internalcomments', 'mod_coursework')); | ||
| $this->_form->setType('internalcomment', PARAM_RAW); | ||
| } | ||
|
|
There was a problem hiding this comment.
From the JIRA ticket: 'As a pair of markers agreeing marks, we want to document the outcome of our discussion and final agreed marking internally and to the external examiner.'
I'm not sure about this, but it looks like internalcomment is editable on this page to those with. So an initial marker, a agreeing marker or an administrator (mod/coursework:administergrades) can see the comment.
How do external examiners see the internalcomments?
This one is read-only: mod/coursework:viewallgradesatalltimes - but it's a write form
@cwarwicker - might be worth asking Eliot who the external examiners are, what capabilities they have, and where in moodle they're supposed to be able to see these comments?
Is that functionality supposed to be part of this ticket?
There was a problem hiding this comment.
This can be paused until CTP-6340 is merged, as then I can add that internal comment to that page.
This is only visible on this page, and never by the student.