Thursday, November 21, 2024

modifications to activity completion report

We've had multiple requests for modifications to Moodle's activity completion report - 31 Aug 2023, the request was to add a cohort id, for which I replied (copy-pasting from email exchange)

Need help. In the activity completion report, we do not get cohort id /name. Could you please modify this system report to include cohort id?

Within my current limited understanding of moodle, I don't think this is possible. 

We can write some sort of ad-hoc report to have the contents of the activity completion report with cohort being one of the fields, but that would end up being
very complicated, because of the different numbers and names of activities over different courses.

A simpler option might be to filter inside google sheets or Excel based on users in the cohort you desire, after importing the csv of activities as one sheet, 
and the list of users + cohort in another sheet. An example is shown here,

 progress-trainer-coordi... (link to google sheet removed)


In the Method1 sheet, the last field EZ has been filtered to include only Our_Cohort_2_2023

There is one complication. Each user can appear in more than one cohort. I've used the LOOKUP function to map user to cohort,
=LOOKUP(B27,Cohortusers!D27:Cohortusers!D3199,Cohortusers!A27:Cohortusers!A3199)
but I think the LOOKUP function returns only the last cohort to which the user belongs. 
A better option might be, if you know which cohort you want, to use a function like
=IF(COUNTIF(OnlyOurCohortusers!$D$2:OnlyOurCohortusers!$D$87, B2)>0,"Yes","No")

This has been implemented in the Method2 sheet of the same spreadsheet file.

For some reason, both these methods seem to return 137 rows, even though the OnlyOurCohort sheet has only 85 rows of data.
I'm not sure why.

I have obtained the cohort users using a "custom report", Site Administration > Reports > (Report builder) > Custom reports
User id by cohort (link removed)

-----------------

Then, in Nov 2024, the users wanted a volunteer to modify the code to add a column 'group' to the activity completion report. Again copy-pasting from an email exchange,

Some additional info to what [the volunteer] has written -

1. Activity completion report plugin is part of moodle core, hence will be updated every time Moodle has an update - which would be approx 3-4 times a year. So, any modified version in, say,
reportmodified/completion/index.php
may need to be edited / checked / corrected after each Moodle update. If it works, no problems. But if it doesn't work, code modifications would be needed.

2. Also, running queries on very large number of users has the possibility to make the database time out. Hence, filtering by smaller groups is advisable.

3. Due to 1 & 2, I would strongly recommend filtering by group, exporting to csv, and then if necessary, aggregating via Google sheets / Microsoft excel etc. 

4. The next best option would be to use ad hoc reports. Again, (2.) is a consideration, ad hoc reports can easily cause system lockups if not executed with care.

5. If (2.) is not an issue - that is, if the activity completion report of all users does not slow down the system, and if you can live with (1.) - that is, have the modified code work for now, but potentially break after a month or so, following which [the volunteer] would again need to check and re-modify the code, only then would I suggest asking him to modify the code and create a modified version of the activity completion report.

And the response was,
As of now the team is convinced that they can generate individual group wise reports. Presently there are about 10 groups. If the number of groups increases, we may need to think of a solution.

- meaning that as of now, no modified version is being used.

No comments:

Post a Comment