Skip to content
Commits on Source (3)
<?php <?php
/** /**
* This file is part of ILIAS, a powerful learning management system * This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V. * published by ILIAS open source e-Learning e.V.
...@@ -16,6 +15,8 @@ ...@@ -16,6 +15,8 @@
* *
*********************************************************************/ *********************************************************************/
declare(strict_types=0);
/** /**
* class ilcourseobjective * class ilcourseobjective
* @author Stefan Meyer <meyer@leifos.com> * @author Stefan Meyer <meyer@leifos.com>
...@@ -392,14 +393,20 @@ class ilCourseObjectiveResult ...@@ -392,14 +393,20 @@ class ilCourseObjectiveResult
public static function __isFullfilled(array $question_points, array $objective_data): bool public static function __isFullfilled(array $question_points, array $objective_data): bool
{ {
global $DIC;
if (!is_array($objective_data['questions'])) { if (!is_array($objective_data['questions'])) {
return false; return false;
} }
$max_points = 0; $max_points = 0;
$reached_points = 0; $reached_points = 0;
foreach ($objective_data['questions'] as $question_id) { foreach ($objective_data['questions'] as $question_id) {
$max_points += $question_points[$question_id]['max_points']; if (array_key_exists($question_id, $question_points)) {
$reached_points += $question_points[$question_id]['reached_points'] ?? 0; $max_points += $question_points[$question_id]['max_points'];
$reached_points += $question_points[$question_id]['reached_points'] ?? 0;
} else {
$DIC->logger()->crs()->warning('stale question in course objective assignment table id ' . $question_id);
}
} }
if (!$max_points) { if (!$max_points) {
return false; return false;
......
...@@ -2080,7 +2080,7 @@ class ilTrQuery ...@@ -2080,7 +2080,7 @@ class ilTrQuery
$res = array(); $res = array();
while ($row = $ilDB->fetchAssoc($set)) { while ($row = $ilDB->fetchAssoc($set)) {
$res[] = array("month" => $row["yyyy"] . "-" . $row["mm"], $res[] = array("month" => $row["yyyy"] . "-" . $row["mm"],
"count" => (int) ($row["counter"] ?? 0) "count" => (int) ($row["COUNTER"] ?? 0)
); );
} }
return $res; return $res;
......