Skip to content

Commit

Permalink
CTP-3004 - show feedback to students only if there is a final grade (#57
Browse files Browse the repository at this point in the history
)

don't use assign function as this writes to the database and myfeedback is designed to be used against read replicas
Co-authored-by: Matthias Opitz <[email protected]>
  • Loading branch information
opitz authored Mar 11, 2024
1 parent f7ef9dc commit afd6d79
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions classes/local/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

namespace report_myfeedback\local;

use assign;
use context;
use context_course;
use context_user;
Expand Down Expand Up @@ -5104,7 +5103,7 @@ public function get_data($archive, $checkdb) {
* userid=
*/
public function get_content($tab = null, $ptutor = null, $padmin = null, $arch = null): stdClass {
global $CFG, $DB, $OUTPUT, $USER;
global $CFG, $OUTPUT, $USER;

$userid = optional_param('userid', 0, PARAM_INT); // User id.
if (empty($userid)) {
Expand Down Expand Up @@ -5390,17 +5389,12 @@ public function get_content($tab = null, $ptutor = null, $padmin = null, $arch =
}
}

// If there is a feedbackstatus or user is progadmin or modtutor
// If there is a student grade or user is progadmin or modtutor
// and any comments or other feedback
// (such as online PDF files, rubrics or marking guides).
require_once($CFG->dirroot . '/mod/assign/locallib.php');
$libcoursecontext = context_course::instance($record->courseid);

$modcontext = \context_module::instance($cm->id);
$assignment = new \assign($modcontext, $cm, $record->userid);
$feedbackstatus = $assignment->get_assign_feedback_status_renderable($USER);

if (($feedbackstatus ||
if (($record->grade ||
has_capability('moodle/user:viewdetails', $usercontext) ||
has_capability('report/myfeedback:progadmin', $libcoursecontext, $USER->id, false) ||
has_capability('report/myfeedback:modtutor', $libcoursecontext, $USER->id, false)
Expand Down

0 comments on commit afd6d79

Please sign in to comment.