Skip to content
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

ILMS-95 - hide grader info from student for kalvidassignment #393

Open
wants to merge 1 commit into
base: MOODLE_400_DEV
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mod/kalvidassign/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<FIELD NAME="emailteachers" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Email submissions to the teacher" PREVIOUS="resubmit" NEXT="grade"/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Maximum grade the assignment is worth" PREVIOUS="emailteachers" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time the assignment was created" PREVIOUS="emailteachers" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the assignment settings were modified" PREVIOUS="timecreated"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the assignment settings were modified" NEXT="hidegrader"/>
<FIELD NAME="hidegrader" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Prevent late submissions" PREVIOUS="timemodified"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
17 changes: 15 additions & 2 deletions mod/kalvidassign/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function xmldb_kalvidassign_upgrade($oldversion) {
}

if ($oldversion < 2014023000.01) {

// Define field metadata to be added to kalvidassign_submission.
//
// // Define field metadata to be added to kalvidassign_submission.
$table = new xmldb_table('kalvidassign_submission');
$field = new xmldb_field('metadata', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timemarked');

Expand All @@ -85,5 +85,18 @@ function xmldb_kalvidassign_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014023000.01, 'kalvidassign');
}

if ($oldversion < 2022041905) {
$table = new xmldb_table('kalvidassign');
$field = new xmldb_field('hidegrader', XMLDB_TYPE_INTEGER, 1, true, true, null, 0, 'timemodified');

// Conditionally launch add field metadata.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
}

// Kalvidassign savepoint reached.
upgrade_mod_savepoint(true, 2014023000.01, 'kalvidassign');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gonenradai do you know what the value for this savepoint should be?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is some indication of the "version" of the DB schema of the module.
That way, if a module needs to update the schema, it can compare the last known save point that is written in the DB and know which steps to perform (for example, if the upgrade is jumping few versions and needs multiple ALTER calls) to upgrade to the latest schema.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the value you want to save is the new version that you're comparing against - 2022041905


return true;
}
2 changes: 2 additions & 0 deletions mod/kalvidassign/lang/en/kalvidassign.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
$string['savedchanges'] = 'Changed Saved';
$string['save'] = 'Save Changes';
$string['cancel'] = 'Close';
$string['hidegrader'] = 'Hide grader identity from students';
$string['hidegrader_help'] = 'If enabled, the identity of any user who grades an assignment submission is not shown, so students can\'t see who marked their work.';
$string['checkconversionstatus'] = 'Check video conversion status';
$string['pluginname'] = 'Kaltura Media Assignment';
$string['video_converting'] = 'The video is still converting. Please check the status of the video at a later time.';
Expand Down
4 changes: 4 additions & 0 deletions mod/kalvidassign/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function definition() {

$this->standard_grading_coursemodule_elements();

$name = get_string('hidegrader', 'kalvidassign');
$mform->addElement('selectyesno', 'hidegrader', $name);
$mform->addHelpButton('hidegrader', 'hidegrader', 'kalvidassign');

$this->standard_coursemodule_elements();

$this->add_action_buttons();
Expand Down
9 changes: 7 additions & 2 deletions mod/kalvidassign/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,14 @@ public function display_grade_feedback($kalvidassign, $context) {
$gradedate = $grade->dategraded;
$gradeby = $grade->usermodified;


// We need the teacher info
if (!$teacher = $DB->get_record('user', array('id'=>$gradeby))) {
print_error('cannotfindteacher');
$teacher = null;
if (!$kalvidassign->hidegrader)
{
if (!$teacher = $DB->get_record('user', array('id'=>$gradeby))) {
print_error('cannotfindteacher');
}
}

// Print the feedback
Expand Down