Track corrected result points
This commit is contained in:
@@ -57,10 +57,16 @@ class ResultModel extends BaseDatabaseModel
|
||||
}
|
||||
unset($answer);
|
||||
|
||||
$pointsAfter = 0;
|
||||
foreach ($item->answers as $answer) {
|
||||
$pointsAfter += (int) ($answer['awarded_points'] ?? 0);
|
||||
}
|
||||
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$row = (object) [
|
||||
'id' => $id,
|
||||
'answers' => json_encode($item->answers, JSON_UNESCAPED_UNICODE),
|
||||
'points_after' => $pointsAfter,
|
||||
];
|
||||
|
||||
return (bool) $db->updateObject('#__testquestions_results', $row, 'id');
|
||||
|
||||
Reference in New Issue
Block a user