Show maximum awarded points
This commit is contained in:
@@ -52,7 +52,8 @@ class ResultModel extends BaseDatabaseModel
|
||||
|
||||
foreach ($item->answers as $questionId => &$answer) {
|
||||
$key = (string) $questionId;
|
||||
$answer['awarded_points'] = max(0, (int) ($awardedPoints[$key] ?? 0));
|
||||
$maxPoints = (int) ($item->questions[(int) $questionId]->points ?? 0);
|
||||
$answer['awarded_points'] = min($maxPoints, max(0, (int) ($awardedPoints[$key] ?? 0)));
|
||||
$answer['comment'] = trim((string) ($comments[$key] ?? ''));
|
||||
}
|
||||
unset($answer);
|
||||
|
||||
Reference in New Issue
Block a user