Skip to content
Snippets Groups Projects
Commit dcab942f authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

make vips grade view consistent with course gradebook, fixes #262

parent b262b7f3
No related branches found
No related tags found
No related merge requests found
......@@ -1487,19 +1487,33 @@ class SolutionsController extends StudipController
foreach ($this->items as $category => $list) {
foreach ($list as $item) {
if ($display == 'points') {
if (isset($p['items'][$category][$item['id']]['points'])) {
$row[] = sprintf('%.1f', $p['items'][$category][$item['id']]['points']);
} else if (isset($p['items'][$category][$item['id']]['weighting'])) {
$row[] = sprintf('%.1f%%', $p['items'][$category][$item['id']]['weighting']);
} else {
$row[] = '';
}
} else {
if (isset($p['items'][$category][$item['id']]['percent'])) {
$row[] = sprintf('%.1f%%', $p['items'][$category][$item['id']]['percent']);
} else {
$row[] = '';
}
}
}
}
if ($display == 'points') {
if (isset($p['overall']['points'])) {
$row[] = sprintf('%.1f', $p['overall']['points']);
} else {
$row[] = '';
}
} else {
if (isset($p['overall']['weighting'])) {
$row[] = sprintf('%.1f%%', $p['overall']['weighting']);
} else {
$row[] = '';
}
if ($this->has_grades) {
$row[] = $p['grade'];
......@@ -1972,8 +1986,7 @@ function participants_overview_data($course_id, $param_user_id, $display = null,
// store reached points, percent and weighted percent for this item, for each group member
$participants[$member_id]['items'][$category][$item_id] = [
'points' => $reached_points,
'percent' => $percent,
'weighting' => $weighted_percent
'percent' => $percent
];
if (!isset($participants[$member_id]['overall'])) {
......@@ -1995,13 +2008,12 @@ function participants_overview_data($course_id, $param_user_id, $display = null,
$participants[$member_id]['items']['tests_seen'][$assignment_id] = true;
if (!isset($participants[$member_id]['items']['blocks'][$item_id])) {
$participants[$member_id]['items']['blocks'][$item_id] = ['points' => 0, 'percent' => 0, 'weighting' => 0];
$participants[$member_id]['items']['blocks'][$item_id] = ['points' => 0, 'percent' => 0];
}
// store reached points, percent and weighted percent for this item, for each group member
$participants[$member_id]['items']['blocks'][$item_id]['points'] += $reached_points;
$participants[$member_id]['items']['blocks'][$item_id]['percent'] += $percent;
$participants[$member_id]['items']['blocks'][$item_id]['weighting'] += $weighted_percent;
if (!isset($participants[$member_id]['overall'])) {
$participants[$member_id]['overall'] = ['points' => 0, 'weighting' => 0];
......@@ -2020,8 +2032,7 @@ function participants_overview_data($course_id, $param_user_id, $display = null,
// store reached points, percent and weighted percent for this item
$participants[$user_id]['items'][$category][$item_id] = [
'points' => $reached_points,
'percent' => $percent,
'weighting' => $weighted_percent
'percent' => $percent
];
if (!isset($participants[$user_id]['overall'])) {
......
......@@ -165,24 +165,19 @@
<? foreach ($items as $category => $list) : ?>
<? foreach ($list as $item) : ?>
<td style="text-align: right; white-space: nowrap;">
<span
<? if (isset($p['items'][$category][$item['id']]['percent'])) : ?>
title="<?= sprintf(_vips('absolut: %.1f %%'), $p['items'][$category][$item['id']]['percent']) ?>"
<? endif ?>>
<? if ($display == 'points') : ?>
<? if (isset($p['items'][$category][$item['id']]['points'])) : ?>
<?= sprintf('%.1f', $p['items'][$category][$item['id']]['points']) ?>
<? else : ?>
&ndash;
<? endif ?>
<? elseif ($display == 'weighting') : ?>
<? if (isset($p['items'][$category][$item['id']]['weighting'])) : ?>
<?= sprintf('%.1f %%', $p['items'][$category][$item['id']]['weighting']) ?>
<? else : ?>
<? if (isset($p['items'][$category][$item['id']]['percent'])) : ?>
<?= sprintf('%.1f %%', $p['items'][$category][$item['id']]['percent']) ?>
<? else : ?>
&ndash;
<? endif ?>
<? endif ?>
</span>
</td>
<? endforeach ?>
<? endforeach ?>
......@@ -194,7 +189,7 @@
<? else: ?>
&ndash;
<? endif ?>
<? elseif ($display == 'weighting') : ?>
<? else : ?>
<? if (isset($p['overall']['weighting'])): ?>
<?= sprintf('%.1f %%', $p['overall']['weighting']) ?>
<? else: ?>
......
......@@ -20,9 +20,6 @@
<th style="text-align: right;">
<?= _vips('Gewichtung') ?>
</th>
<th style="text-align: right;">
<?= _vips('gewichtete Prozent') ?>
</th>
<? endif ?>
</tr>
</thead>
......@@ -34,18 +31,14 @@
<? foreach (['tests', 'blocks', 'exams'] as $category) : ?>
<? foreach ($items[$category] as $item) : ?>
<? if ($item['item']->isVisible($user_id) && $item['weighting']) : ?>
<? $reached_points = $me['items'][$category][$item['id']]['points'] ?>
<? $percent = $me['items'][$category][$item['id']]['percent'] ?>
<? $weighted_percent = $me['items'][$category][$item['id']]['weighting'] ?>
<tr>
<td>
<?= htmlReady($item['name']) ?>
</td>
<td style="text-align: right;">
<? if (isset($reached_points)) : ?>
<?= sprintf('%g', $reached_points) ?>
<? if (isset($me['items'][$category][$item['id']]['points'])) : ?>
<?= sprintf('%g', $me['items'][$category][$item['id']]['points']) ?>
<? else : ?>
&ndash;
<? endif ?>
......@@ -60,8 +53,8 @@
</td>
<td style="text-align: right;">
<? if (isset($percent)) : ?>
<?= sprintf('%.1f %%', $percent) ?>
<? if (isset($me['items'][$category][$item['id']]['percent'])) : ?>
<?= sprintf('%.1f %%', $me['items'][$category][$item['id']]['percent']) ?>
<? else : ?>
&ndash;
<? endif ?>
......@@ -71,14 +64,6 @@
<td style="text-align: right;">
<?= sprintf('%.1f %%', $item['weighting']) ?>
</td>
<td style="text-align: right;">
<? if (isset($weighted_percent)) : ?>
<?= sprintf('%.1f %%', $weighted_percent) ?>
<? else : ?>
&ndash;
<? endif ?>
</td>
<? endif ?>
</tr>
<? endif ?>
......@@ -88,16 +73,19 @@
<tfoot>
<tr>
<td colspan="<?= $use_weighting ? 6 : 4 ?>" style="padding: 5px;">
<td colspan="4" style="padding: 5px;">
<?= _vips('Prozent, gesamt') ?>
</td>
<td style="padding: 5px; text-align: right;">
<?= sprintf('%.1f %%', $me['overall']['weighting']) ?>
</td>
<? if ($use_weighting) : ?>
<td></td>
<? endif ?>
</tr>
<tr style="font-weight: bold;">
<td colspan="<?= $use_weighting ? 7 : 5 ?>" style="text-align: center;">
<td colspan="<?= $use_weighting ? 6 : 5 ?>" style="text-align: center;">
<?= _vips('Note:') ?>
<?= htmlReady($me['grade']) ?>
<? if ($me['grade_comment'] != '') : ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment