mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
MDL-42670 mod_assign: Fix recent activity block when blind marking is on
This commit is contained in:
parent
f06d8d94a1
commit
d89dc6daa5
@ -680,7 +680,14 @@ function assign_print_recent_activity($course, $viewfullnames, $timestart) {
|
||||
|
||||
foreach ($show as $submission) {
|
||||
$cm = $modinfo->get_cm($submission->cmid);
|
||||
$context = context_module::instance($submission->cmid);
|
||||
$assign = new assign($context, $cm, $cm->course);
|
||||
$link = $CFG->wwwroot.'/mod/assign/view.php?id='.$cm->id;
|
||||
// Obscure first and last name if blind marking enabled.
|
||||
if ($assign->is_blind_marking()) {
|
||||
$submission->firstname = get_string('participant', 'mod_assign');
|
||||
$submission->lastname = $assign->get_uniqueid_for_user($submission->userid);
|
||||
}
|
||||
print_recent_activity_note($submission->timemodified,
|
||||
$submission,
|
||||
$cm->name,
|
||||
|
@ -225,6 +225,30 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase {
|
||||
$sink->close();
|
||||
}
|
||||
|
||||
/** Make sure blind marking shows participant \d+ not fullname when assign_print_recent_activity is triggered. */
|
||||
public function test_print_recent_activity_fullname_blind_marking() {
|
||||
// Submitting an assignment generates a notification in blind marking.
|
||||
$this->preventResetByRollback();
|
||||
$sink = $this->redirectMessages();
|
||||
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$assign = $this->create_instance(array('blindmarking' => 1));
|
||||
|
||||
$data = new stdClass();
|
||||
$data->userid = $this->students[0]->id;
|
||||
$notices = array();
|
||||
$this->setUser($this->students[0]);
|
||||
$assign->submit_for_grading($data, $notices);
|
||||
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$uniqueid = $assign->get_uniqueid_for_user($data->userid);
|
||||
$expectedstr = preg_quote(get_string('participant', 'mod_assign'), '/') . '.*' . $uniqueid;
|
||||
$this->expectOutputRegex("/{$expectedstr}/");
|
||||
assign_print_recent_activity($this->course, false, time() - 3600);
|
||||
|
||||
$sink->close();
|
||||
}
|
||||
|
||||
public function test_assign_get_recent_mod_activity() {
|
||||
// Submitting an assignment generates a notification.
|
||||
$this->preventResetByRollback();
|
||||
|
Loading…
x
Reference in New Issue
Block a user