Why is certificate module creating calendar events ?

Why is certificate module creating calendar events ?

by Jean-Michel Védrine -
Number of replies: 9

Hello,

I just created a Moodle 2.0 test website and added the certificate mod version I downloaded from the link Charlème gave in this forum a few days ago.

I just noticed that certificate module is creating a calendar event when you create a certificate module's instance (and update it when you update the certificate instance).

I fail to see the reason for this. What purpose serve this events without any date  ?

Can somebody explain ?

Additionnaly if this feature is usefull, the code is using the deprecated add_event function and should be updated to calendar_event::create

What would be really interesting would be to use Moodle's events/notification/subscription layer (Isit totaly implemented ? I am not quite sure, I must check) so that users could be notified of certificate events. But in that case certificate should call events_trigger not add_event.

Average of ratings: -
In reply to Jean-Michel Védrine

Re: Why is certificate module creating calendar events ?

by Chardelle Busch -
Picture of Core developers

It does use the notification system for sending notifications to teachers.

As for add instance--yes it should be updated--good catch.

In reply to Chardelle Busch

Re: Why is certificate module creating calendar events ?

by Jean-Michel Védrine -

Yes the fact that you have upgraded certificate to using the messaging system for teachers notifications is very good and with the new features of messaging in Moodle 2.1 it's even more interesting to be able to set default messaging outputs for Certificate in Administration (Site Administration > Plugins > Messages outputs > Manage messages outputs) and that each teacher can customize it in his profile (My profile settings > messaging).

In reply to Chardelle Busch

Re: Why is certificate module creating calendar events ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I have just hit this problem.

Using the Event API to manage sending messages to teachers is sensible.

However, Moodle events API is a completely different thing from Moodle calendar events (althought the naming is really confusing).

Therefore, what is this code doing other than causing errors? ("Error: mdb->get_record() found more than one record!" after you edit a certificate a few times.) I think that if/else statement should just be deleted.

In reply to Tim Hunt

Re: Why is certificate module creating calendar events ?

by Jean-Michel Védrine -

Hello Tim,

Glad you say that smile There is now more than 1 year that I said this code is wrong : it makes sense that quiz or assignement activities create calendar events because these activities can have close or due dates associated but it doesn't makes sense that the certificate activity create calendar events (using a deprecated function !) without any date !

 

In reply to Jean-Michel Védrine

Re: Why is certificate module creating calendar events ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

How does Mark Nelson like proposed changes? Pull request on github, or patch on a tracker issue? And, shall I make a patch for this?

In reply to Tim Hunt

Re: Why is certificate module creating calendar events ?

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
In reply to Matteo Scaramuccia

Re: Why is certificate module creating calendar events ?

by Jean-Michel Védrine -

Unfortunately Mark seems very busy now with his work at Moodle HQ. There is already a pull request from Jamie Pratt (not for this issue, for something else about pagination if I remember well) waiting somewhere.

In reply to Jean-Michel Védrine

Re: Why is certificate module creating calendar events ?

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Jean-Michel,
yes for sure but it seems he is happy with the Tracker e.g. https://github.com/markn86/moodle-mod_certificate/pull/19#issuecomment-11870987.

Pratt's issue has been recorded into the tracker too: CONTRIB-4091.

The reference for the issue discussed here is: CONTRIB-4124. I'm pretty sure Mark will like a fix proposal as well wink.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Why is certificate module creating calendar events ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Thanks for that tracker issue. I just made a patch and put the details there.