davosmith / moodle-checklist

Checklist plugin for Moodle - allows a teacher to create a checklist for their students to tick-off
GNU General Public License v3.0
24 stars 68 forks source link

Activity name only updates after teacher views checklist again #88

Closed PhMemmel closed 2 years ago

PhMemmel commented 2 years ago

To reproduce:

Expected behavior: Student should see checklist with updated activity's name as soon as the activity's name has been updated. There should be no need for the teacher to click on the checklist item again to trigger this update.

Observed in moodle 3.11.4 at checklist commit id 070a30792d9af7a0e5b0715020b322a1c6079b0d, also at latest master (cb6e97c78be6550f91df860e35937e855ef3bee7)

davosmith commented 2 years ago

OK - I'll try to take a look at some point. This is a fairly minor improvement, in that it only happens if activities are renamed (which probably doesn't happen a huge amount once a course is live) and can be easily fixed by a teacher visiting the checklist.

If you have a fix, then I'd be happy to review and merge it. Otherwise it'll have to wait until I have some spare time to investigate.

PhMemmel commented 2 years ago

I agree, it is only a minor issue. However, the bigger problem is, that the teacher doesn't know about it. So he/she renames the activities and just assumes that the change has happened in the checklist as well. Students will be irritated by a wrong name, especially considering the following scenario (that's why I stumbled over this bug):

A course/section is being provided to teachers as a template for their own courses: The idea of the template is that the activites itself may only be accessed via the checklist (so activities are hidden, but accessible). Teachers import or duplicate the template activities and the checklist activity, then start to just rename the given activities with the template names "ACTIVITY 1, PLEASE CHANGE NAME". Students then only will find a checklist with a list of wrong activity names for their daily "Todo":

But overall: Yes, not too big of a deal :-)

If I have time to dive into the code and provide a fix, I will leave a comment here. Can't promise right now, sorry.

davosmith commented 2 years ago

I had a quick look - it seems that there is a sensible check in the code that prevents students from changing the text of any item that is not their own.

So, although the code is looping through and detecting that the name needs updating, the user doesn't have permission to do so.

I'd need to figure out a way to disable this check in the case where the update is being done by the automatic code, rather than a request from the browser ...

davosmith commented 2 years ago

I've pushed a fix that should solve the problem - it's running the automated checks at the moment, but I'm pretty certain this will work as expected.

The code is in github now if you want to see if it solves your problem.

PhMemmel commented 2 years ago

Hi @davosmith, I just doublechecked against the latest revision in master. I can confirm the bug is fixed. Thank you very much for the fast analysis and the quick fix!