[FIX] LTI: Provide outcome status lists for LP collections#11641
Conversation
| $usr_ids = array(); | ||
| $query = 'SELECT DISTINCT usr_id FROM ut_lp_marks' | ||
| . ' WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer') | ||
| . ' AND status = ' . $ilDB->quote($a_status, 'integer'); | ||
|
|
||
| $res = $ilDB->query($query); | ||
| while ($row = $ilDB->fetchAssoc($res)) { | ||
| $usr_ids[] = (int) $row['usr_id']; | ||
| } | ||
|
|
||
| return $usr_ids; |
There was a problem hiding this comment.
Hi @Saaweel ,
I just stumbled across these changes and am not sure whether the overridden methods have been implemented as intended. From my understanding _getInProgress, _getCompleted, _getFailed and _getNotAttempeted are expected to return lists of user IDs for the respective status based on the underlying learning progress data, rather than on the aggregated status values stored in ut_lp_marks.
Let's assume that \ilLPStatusWrapper::_refreshStatus() is invoked for the consuming object. This eventually calls \ilLPStatus::refreshStatus(), which in turn invokes the methods overridden here.
The returned user ID lists are then used to persist the corresponding learning progress status in ut_lp_marks.
Kind regards,
Michael
There was a problem hiding this comment.
Hi @mjansenDatabay ,
thanks for the feedback, and sorry for the late response. I had not seen your comment earlier because, for some reason, GitHub did not notify me about it.
I reviewed this again and agree that these methods should not derive their user lists from ut_lp_marks, since they can also be used during ilLPStatusWrapper::_refreshStatus() to recalculate and persist that table.
I prepared a follow-up PR that derives the LTI outcome status lists from the underlying outcome data instead:
#11667
The lists now use lti_consumer_results and lti_consumer_grades, if available, and classify users through the existing determineStatus() logic. This keeps parent object / LP collection aggregation working without depending on the aggregated LP table.
Kind regards,
Saúl
Certain missing and/or inherited functions have been added to ensure that learning progress is correctly transferred to the parent object in all cases.
Mantis ticket: https://mantis.ilias.de/view.php?id=41919