Training statistic errors if there's a course without modules

Created on 24 May 2023, over 1 year ago
Updated 11 August 2023, over 1 year ago

Problem/Motivation

When there's a course without a module and the user goes to See progress it results in a 500 error:

DivisionByZeroError: Division by zero in Drupal\opigno_learning_path\Controller\LearningPathAchievementController->getStatusPercentCourseByStep() (line 669 of modules/contrib/opigno_learning_path/src/Controller/LearningPathAchievementController.php).

Steps to reproduce

Create a course without adding any module, then click on the See Progress button. Example url: `group/1/training-statistic`

Proposed resolution

Check that there are steps

$passed_percent = $course_steps['total'] ? round(($course_steps['passed'] / $course_steps['total']) * 100) : 0;

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇪🇸Spain jsbalsera Córdoba, Spain

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024