CI: Fix psalm EmptyArrayAccess errors

pull/5020/head
Angel Fernando Quiroz Campos 12 months ago
parent b0f75d42ff
commit 3afcccfe9b
  1. 9
      public/main/inc/lib/userportal.lib.php
  2. 6
      public/main/tracking/course_session_report.php
  3. 5
      src/CoreBundle/State/CategorizedExerciseResultStateProvider.php

@ -930,7 +930,10 @@ class IndexManager
$this->load_directories_preview,
$useUserLanguageFilterIfAvailable
);*/
$courses = [];
$courses = [
'in_category' => [],
'not_category' => [],
];
// Course option (show student progress)
// This code will add new variables (Progress, Score, Certificate)
@ -981,7 +984,6 @@ class IndexManager
}
}
if (isset($courses['in_category'])) {
foreach ($courses['in_category'] as $key1 => $value) {
if (isset($courses['in_category'][$key1]['courses'])) {
foreach ($courses['in_category'][$key1]['courses'] as $key2 => $courseInCatInfo) {
@ -1043,9 +1045,7 @@ class IndexManager
}
}
}
}
if (isset($courses['not_category'])) {
foreach ($courses['not_category'] as $key => $courseNotInCatInfo) {
$courseCode = $courseNotInCatInfo['course_code'];
if ($studentInfoProgress) {
@ -1100,7 +1100,6 @@ class IndexManager
}
}
}
}
}
if ($viewGridCourses) {

@ -157,7 +157,13 @@ if (!empty($users) && is_array($users)) {
);
$total_course += $result;
$total_result_by_user += $result;
if (!isset($course_average[$current_course['code']])) {
$course_average[$current_course['code']] = 0;
}
$course_average[$current_course['code']] += $total_course;
if (!isset($course_average_counter[$current_course['code']])) {
$course_average_counter[$current_course['code']] = 0;
}
$course_average_counter[$current_course['code']]++;
$result = $result.' ('.$user_info_stat['attempts'].' '.get_lang('Attempts').')';
$counter++;

@ -302,7 +302,10 @@ class CategorizedExerciseResultStateProvider implements ProviderInterface
}
if (($show_results || $show_only_score) && $showTotalScore) {
if (MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY !== $result['answer_type']) {
if ($result
&& isset($result['answer_type'])
&& MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY !== $result['answer_type']
) {
$pluginEvaluation = QuestionOptionsEvaluationPlugin::create();
if ('true' === $pluginEvaluation->get(QuestionOptionsEvaluationPlugin::SETTING_ENABLE)) {
$formula = $pluginEvaluation->getFormulaForExercise($objExercise->getId());

Loading…
Cancel
Save