diff --git a/controllers/solutions.php b/controllers/solutions.php index b37b5405cccae0a70dac976b3a7fed5faf54308a..4549ac14b3926d1c93e987dbe01798b1771cb091 100644 --- a/controllers/solutions.php +++ b/controllers/solutions.php @@ -1487,19 +1487,33 @@ class SolutionsController extends StudipController foreach ($this->items as $category => $list) { foreach ($list as $item) { if ($display == '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']); + if (isset($p['items'][$category][$item['id']]['points'])) { + $row[] = sprintf('%.1f', $p['items'][$category][$item['id']]['points']); + } else { + $row[] = ''; + } } else { - $row[] = ''; + if (isset($p['items'][$category][$item['id']]['percent'])) { + $row[] = sprintf('%.1f%%', $p['items'][$category][$item['id']]['percent']); + } else { + $row[] = ''; + } } } } if ($display == 'points') { - $row[] = sprintf('%.1f', $p['overall']['points']); + if (isset($p['overall']['points'])) { + $row[] = sprintf('%.1f', $p['overall']['points']); + } else { + $row[] = ''; + } } else { - $row[] = sprintf('%.1f%%', $p['overall']['weighting']); + 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'])) { diff --git a/views/solutions/participants_overview.php b/views/solutions/participants_overview.php index 8d6350d4cea43eb839cfbcf443bbfc0368d4571c..062f13a94426027b8890342c96614ebabdb35bfc 100644 --- a/views/solutions/participants_overview.php +++ b/views/solutions/participants_overview.php @@ -165,24 +165,19 @@ <? foreach ($items as $category => $list) : ?> <? foreach ($list as $item) : ?> <td style="text-align: right; white-space: nowrap;"> - <span + <? if ($display == 'points') : ?> + <? if (isset($p['items'][$category][$item['id']]['points'])) : ?> + <?= sprintf('%.1f', $p['items'][$category][$item['id']]['points']) ?> + <? else : ?> + – + <? endif ?> + <? else : ?> <? 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 : ?> - – - <? endif ?> - <? elseif ($display == 'weighting') : ?> - <? if (isset($p['items'][$category][$item['id']]['weighting'])) : ?> - <?= sprintf('%.1f %%', $p['items'][$category][$item['id']]['weighting']) ?> - <? else : ?> - – - <? endif ?> + <?= sprintf('%.1f %%', $p['items'][$category][$item['id']]['percent']) ?> + <? else : ?> + – <? endif ?> - </span> + <? endif ?> </td> <? endforeach ?> <? endforeach ?> @@ -194,7 +189,7 @@ <? else: ?> – <? endif ?> - <? elseif ($display == 'weighting') : ?> + <? else : ?> <? if (isset($p['overall']['weighting'])): ?> <?= sprintf('%.1f %%', $p['overall']['weighting']) ?> <? else: ?> diff --git a/views/solutions/student_grade.php b/views/solutions/student_grade.php index 30e0361992fc9122cbd4590615af84888213223e..ba88649e4cc9028020e591b0fed1150c34b14310 100644 --- a/views/solutions/student_grade.php +++ b/views/solutions/student_grade.php @@ -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 : ?> – <? 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 : ?> – <? 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 : ?> - – - <? 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'] != '') : ?>