Skip to content

Commit

Permalink
CR update
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartlamour committed Nov 22, 2024
1 parent b2acb06 commit e8b0ba5
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions block_my_feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ class block_my_feedback extends block_base {
public function init() {
global $USER;

// If $USER->firstname is not set yet do not try to use it.
if (!isset($USER->firstname)) {
$this->title = get_string('pluginname', 'block_my_feedback');
} else if (self::is_teacher()) {
$this->title = get_string('markingfor', 'block_my_feedback').' '.$USER->firstname;
} else {
$this->title = get_string('feedbackfor', 'block_my_feedback').' '.$USER->firstname;
if (self::is_teacher()) {
$this->title = get_string('markingfor', 'block_my_feedback').' '.$USER->firstname;
}
}
}

Expand Down Expand Up @@ -87,7 +85,6 @@ public function get_content(): stdClass {
* @param stdClass $user
*/
public function fetch_marking(stdClass $user): ?array {
global $DB, $OUTPUT;
// User courses.
$courses = enrol_get_all_users_courses($user->id, false, ['enddate']);
// Marking.
Expand All @@ -103,7 +100,7 @@ public function fetch_marking(stdClass $user): ?array {
continue;
}
// Skip if no summative assessments.
if (!$summatives = assess_type::get_assess_type_records_by_courseid($course->id, "1")) {
if (!$summatives = assess_type::get_assess_type_records_by_courseid($course->id, 1)) {
continue;
}

Expand Down Expand Up @@ -311,10 +308,7 @@ public function fetch_feedback($user): ?array {
$template->feedback[] = $feedback;
}

if ($template->feedback) {
return $template->feedback;
}
return null;
return $template->feedback ?: null;
}

/**
Expand Down

0 comments on commit e8b0ba5

Please sign in to comment.