Show percentages for original and corrected points
This commit is contained in:
@@ -82,7 +82,9 @@ class SetModel extends BaseDatabaseModel
|
||||
}
|
||||
|
||||
$pointsBefore = 0;
|
||||
$pointsTotal = 0;
|
||||
foreach (($result['items'] ?? []) as $item) {
|
||||
$pointsTotal += (int) ($item['points'] ?? 0);
|
||||
if (!empty($item['correct'])) {
|
||||
$pointsBefore += (int) ($item['points'] ?? 0);
|
||||
}
|
||||
@@ -97,6 +99,7 @@ class SetModel extends BaseDatabaseModel
|
||||
'correct_count' => (int) ($result['correct'] ?? 0),
|
||||
'total_count' => (int) ($result['total'] ?? 0),
|
||||
'percentage' => (float) ($result['percentage'] ?? 0),
|
||||
'points_total' => $pointsTotal,
|
||||
'points_before' => $pointsBefore,
|
||||
'points_after' => $pointsBefore,
|
||||
'answers' => json_encode($result['items'] ?? [], JSON_UNESCAPED_UNICODE),
|
||||
|
||||
Reference in New Issue
Block a user