Skip to content

Commit

Permalink
GH-678 Remove reduntant description for missing result
Browse files Browse the repository at this point in the history
If no specific scale can be identified, we already show a text with this
information. In addition, there was a comment also providing information
about why there is no result. To simplify and prevent confusion, the
extra comments are removed.
  • Loading branch information
davidszkiba committed Oct 15, 2024
1 parent 2bb499f commit 4879d85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
42 changes: 5 additions & 37 deletions classes/teststrategy/feedbackgenerator/customscalefeedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,15 @@ public function get_studentfeedback(array $data): array {
(array) $progress->get_quiz_settings(),
$data['catscales']
);
$firstelement = $data['customscalefeedback_abilities'][array_key_first($data['customscalefeedback_abilities'])];
$comment = $this->get_comment($firstelement);

if (empty($customscalefeedback)) {
return [];
} else {
return [
'heading' => $this->get_heading(),
'comment' => $comment,
'content' => $customscalefeedback,
];
}

return [
'heading' => $this->get_heading(),
'content' => $customscalefeedback,
];
}

/**
Expand Down Expand Up @@ -339,33 +336,4 @@ private function getfeedbackforrange(int $catscaleid, int $groupnumber, array $q

return $content;
}

/**
* Get the comment line for the feedback
*
* @param array $firstelement
* @return string
*/
private function get_comment(array $firstelement): string {
if (empty($firstelement['estimated'])) {
return "";
}

if (count($this->get_progress()->get_playedquestions()) === 0) {
return "";
}

if (!isset($firstelement['fraction'])) {
return get_string('estimatedbecause:default', 'local_catquiz');
}

switch ((int) $firstelement['fraction']) {
case 1:
return get_string('estimatedbecause:allanswerscorrect', 'local_catquiz');
case 0:
return get_string('estimatedbecause:allanswersincorrect', 'local_catquiz');
}

return get_string('estimatedbecause:default', 'local_catquiz');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ public static function get_studentfeedback_provider(): array {
'expected' => [
'heading' => 'Feedback',
'content' => '<p dir="ltr" style="text-align: left;">adsfafs<\/p><br/>',
'comment' => '',
],
],
'noscalestoreport' => [
Expand Down Expand Up @@ -173,10 +172,8 @@ public static function get_studentfeedback_provider(): array {
'expected' => [
'heading' => 'Feedback',
'content' => 'No valid feedback could be generated.',
'comment' => '',
],
],
];
}

}

0 comments on commit 4879d85

Please sign in to comment.