LpSteps::getCourseStep should include max score

Created on 9 May 2025, 28 days ago

Problem/Motivation

Throughout Opigno, multiple modules assume that the user_module_status table stores the scores in points. This is incorrect, and values are stored as an integer percent (0-100). This creates a problem in other Opigno modules as LP steps now have no way to calculate the module's score in points for comparison with 'required score'.

Elsewhere in opigno_modules, the score in points is calculated in reference to the max score:

score_in_points = best_score * max_score / 100.

Without this, the best_score is always 0-100, and there's no way to compare it to 'required score'.

Steps to reproduce

This is most often exposed when an activity or module is manually scored. Without the max_score, opigno_module compares best_score to required score, and unless the required score is exactly 100 points, the comparison will give erroneous results.

Proposed resolution

Add the max score to the output of the array. This should be used in concert with other patches which correct this problem in opigno_module:

* https://www.drupal.org/project/opigno_module/issues/3521268 πŸ› getAttemptScore() calculates scores incorrectly Active

Remaining tasks

Create patch.

User interface changes

None.

API changes

The max score for the step will now be present in the output array.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

3.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States socketwench

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

Comments & Activities

Production build 0.71.5 2024