Skip to content

Commit

Permalink
MDL-62366 mod_assign: Followup fix for attemptnumber in exported JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
zig-moodle committed May 10, 2018
1 parent 02c7769 commit 0139b88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mod/assign/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ protected static function export_grade_data(\stdClass $grade, \context $context,
'timemodified' => transform::datetime($grade->timemodified),
'grader' => transform::user($grade->grader),
'grade' => $grade->grade,
'attemptnumber' => $grade->attemptnumber
'attemptnumber' => ($grade->attemptnumber + 1)
];
writer::with_context($context)
->export_data(array_merge($currentpath, [get_string('privacy:gradepath', 'mod_assign')]), $gradedata);
Expand All @@ -395,7 +395,7 @@ protected static function export_submission_data(\stdClass $submission, \context
'timemodified' => transform::datetime($submission->timemodified),
'status' => get_string('submissionstatus_' . $submission->status, 'mod_assign'),
'groupid' => $submission->groupid,
'attemptnumber' => $submission->attemptnumber,
'attemptnumber' => ($submission->attemptnumber + 1),
'latest' => transform::yesno($submission->latest)
];
writer::with_context($context)
Expand Down
4 changes: 2 additions & 2 deletions mod/assign/tests/privacy_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ public function test_export_user_data_student() {
// Check Submissions.
$this->assertEquals($submissiontext, $writer->get_data(['attempt 1', 'Submission Text'])->text);
$this->assertEquals($submissiontext2, $writer->get_data(['attempt 2', 'Submission Text'])->text);
$this->assertEquals(0, $writer->get_data(['attempt 1', 'submission'])->attemptnumber);
$this->assertEquals(1, $writer->get_data(['attempt 2', 'submission'])->attemptnumber);
$this->assertEquals(1, $writer->get_data(['attempt 1', 'submission'])->attemptnumber);
$this->assertEquals(2, $writer->get_data(['attempt 2', 'submission'])->attemptnumber);
// Check grades.
$this->assertEquals($grade1, $writer->get_data(['attempt 1', 'grade'])->grade);
$this->assertEquals($grade2, $writer->get_data(['attempt 2', 'grade'])->grade);
Expand Down

0 comments on commit 0139b88

Please sign in to comment.