Skip to content

Commit

Permalink
CTP-3560 avoid PHPUnit errors
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Sep 2, 2024
1 parent 91f453d commit 6fa0659
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions classes/export/csv/cells/feedbackcomments_cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class feedbackcomments_cell extends cell_base {
*/
public function get_cell($submission, $student, $stage_identifier) {

$stage_identifier = ($this->coursework->get_max_markers() == 1) ? "assessor_1" : $this->get_stage_identifier_for_assessor($submission, $student);
$stage_identifier = ($this->coursework->get_max_markers() == 1)
? "assessor_1" : $this->get_stage_identifier_for_assessor($submission, $student);
$grade = $submission->get_assessor_feedback_by_stage($stage_identifier);
return (!$grade) ? '' : strip_tags($grade->feedbackcomment);
return (!$grade || !isset($grade->feedbackcomment)) ? '' : strip_tags($grade->feedbackcomment);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion classes/grade_judge.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public function get_grade_capped_by_submission_time($submission) {
* @return float
*/
private function round_grade_decimals($grade) {
return round($grade, 2);
if ($grade !== null) {
return round($grade, 2);
}
}

/**
Expand Down
5 changes: 3 additions & 2 deletions classes/models/feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ public function get_submission() {

if (!isset($this->submission) && !empty($this->submissionid)) {
global $DB;
$coursework_id = $this->courseworkid ?? $DB->get_field(submission::$table_name, 'courseworkid', ['id' => $this->submissionid], MUST_EXIST);
$coursework_id = $this->courseworkid
?? $DB->get_field(submission::$table_name, 'courseworkid', ['id' => $this->submissionid], MUST_EXIST);
if (!isset(submission::$pool[$coursework_id])) {
submission::fill_pool_coursework($coursework_id);
}
Expand Down Expand Up @@ -651,7 +652,7 @@ public static function fill_pool_submissions($coursework_id, $submission_ids) {
* @param $coursework_id
* @param $key
* @param $params
* @return bool
* @return self|bool
*/
public static function get_object($coursework_id, $key, $params) {
if (!isset(self::$pool[$coursework_id])) {
Expand Down
1 change: 1 addition & 0 deletions classes/models/null_feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* class.
*
*/
#[\AllowDynamicProperties]
class null_feedback {

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function create_feedback($feedback) {
$feedback->finalised = 1;
}

$feedback->save();
$feedback->id = $feedback->save();

return $feedback;
}
Expand Down

0 comments on commit 6fa0659

Please sign in to comment.