gjbarnard / moodle-format_grid

Grid course format contributed by Gareth J Barnard originally created by Paul Krix
GNU General Public License v3.0
21 stars 56 forks source link

Better way to calculate completion progress #180

Closed lengyelke closed 1 year ago

lengyelke commented 1 year ago

When you calculate the completion progress in protected function calculate_section_activity_completion($section, $course, $modinfo, \renderer_base $output) at line 331 in \grid\classes\output\courseformat\content.php you count all the visible modules. But just because a module is visible, it doesn't mean it is available to the students. You can set up restrictions (for example be a member of a certain group) to be able to access that visible activity. So you can have 10 visible activities but only 6 available to the student, as they can have optional units or time-restricted activities, or they need to choose between activity A and activity B but they cannot complete both.

I think your calculation would be more accurate if you use the if ($thismod->available) { instead of if ($thismod->visible) { This is an easy fix/change, but if you can add it to the settings and users can choose which method they want to use, that would be even better. I hope you like the idea. To me, it is more like a bug so I wasn't sure how to report it. Thanks Ferenc

gjb2048 commented 1 year ago

@lengyelke Interesting. I'll have a look when I get the time.

gjb2048 commented 1 year ago

Ok as cm_info has '@property-read bool $available True if this course-module is available to students i.e. if all availability conditions are met - obtained dynamically' then agree - not going to add a setting though.