iomad / iomad

Iomad
GNU General Public License v3.0
159 stars 225 forks source link

IOMAD 4.3.8: completion_digest_manager email is not sent anymore #2048

Open tom5850 opened 1 week ago

tom5850 commented 1 week ago

I'm not sure when it exactly stopped working, but I assume it was when we upgraded from 4.2 to 4.3.

Since then our company managers do not recive any completion_digest_manager emails anymore.

Our settings are:

Edit company: Send manager emails: Both completion and reminder emails Send manager digest emails on: Friday

Email templates: completion_digest_manager: activated Email re-send every: Daily (daily for testing purposes) Email re-send amount: 0 Email re-send day: Any

dallenk commented 1 week ago

unfortunately this one has been broken for a very long time. i still have hope it will get fixed.

https://github.com/iomad/iomad/issues/1914 https://github.com/iomad/iomad/issues/1982

tom5850 commented 1 week ago

Hmm, interesting, I can say that in August we have seen such mails sent out by our test system. Then after 3-4 such mails sent out weekly, it stopped suddenly. The only change we did around that time was an IOMAD upgrade. But maybe that's a coincidence and the reason lies somewhere else.

turf212 commented 4 days ago

all of the processing for the email reports was spilt out into their own separate tasks but this was back in 2022 - so unsure where it actually stopped working.

In any case - I've reworked that task to a new task and created 2 new tasks and digest emails for course completions in the last week and training expiring in the coming week. The email templates for these last two have been added as disabled to existing systems, so you will need to switch them on if you want them in the tenant (I did this to prevent emails going out on upgrade that you didn't know about and then all of your tenant complaining that they were getting them!). Same for any template sets you may have saved - they are added disabled.

You can either do this by tenant in the GUI or in the database for everyone.

update mdl_email_template set disabled=0 where name='expiring_digest_manager';
update mdl_email_template set disabled=0 where name='warning_digest_manager';

(can also add and companyid = or in (1,2,3,) )

and

update mdl_email_templateset_templates set disabled=0 where name='expiring_digest_manager';
update mdl_email_templateset_templates set disabled=0 where name='warning_digest_manager';

This has been pushed to 4.1, 4.2 and 4.3 branches.

dallenk commented 2 days ago

thank you so much for working on this, maybe i have something misconfigured now but the manager isn't getting the on-demand completion emails when a student completes a course and receives a certificate. Only the student receives the email. IOMAD certificate settings: image

Company is configured for notifications: image

no templates disabled that have anything to do with course completion or digest:

select companyid,name,disabled from mdl_email_template where disabled=1;
+-----------+----------------------------------+----------+
| companyid | name                             | disabled |
+-----------+----------------------------------+----------+
|        10 | admin_deleted                    |        1 |
|        10 | advertise_classroom_based_course |        1 |
|        12 | admin_deleted                    |        1 |
|        12 | advertise_classroom_based_course |        1 |
|        13 | admin_deleted                    |        1 |
|        13 | advertise_classroom_based_course |        1 |
|         9 | admin_deleted                    |        1 |
|         9 | advertise_classroom_based_course |        1 |
|        11 | admin_deleted                    |        1 |
|        11 | advertise_classroom_based_course |        1 |
|         8 | admin_deleted                    |        1 |
|         8 | advertise_classroom_based_course |        1 |
|         6 | advertise_classroom_based_course |        1 |
|         7 | advertise_classroom_based_course |        1 |
|        18 | advertise_classroom_based_course |        1 |
|        16 | advertise_classroom_based_course |        1 |
|        25 | advertise_classroom_based_course |        1 |
|        28 | advertise_classroom_based_course |        1 |
|        23 | advertise_classroom_based_course |        1 |
|        14 | advertise_classroom_based_course |        1 |
|        17 | advertise_classroom_based_course |        1 |
|        29 | advertise_classroom_based_course |        1 |
|        19 | advertise_classroom_based_course |        1 |
|        24 | advertise_classroom_based_course |        1 |
|        21 | advertise_classroom_based_course |        1 |
|         3 | advertise_classroom_based_course |        1 |
|        26 | advertise_classroom_based_course |        1 |
|         1 | advertise_classroom_based_course |        1 |
|         4 | advertise_classroom_based_course |        1 |
|        15 | advertise_classroom_based_course |        1 |
|         2 | advertise_classroom_based_course |        1 |
|         5 | advertise_classroom_based_course |        1 |
|        27 | advertise_classroom_based_course |        1 |
|        22 | advertise_classroom_based_course |        1 |
+-----------+----------------------------------+----------+
34 rows in set (0.002 sec)
select name,disabled from mdl_email_templateset_templates where disabled=1;
+----------------------------------+----------+
| name                             | disabled |
+----------------------------------+----------+
| admin_deleted                    |        1 |
| advertise_classroom_based_course |        1 |
| advertise_classroom_based_course |        1 |
+----------------------------------+----------+
3 rows in set (0.001 sec)

Previously, when a member completed a course, they would get an email right away with their certificate, the manager would also get a copy of the email at the same time. Is this only going to work with a digest now? I don't use digest, and the instructors would prefer to get the right away instead of once a week.

Thanks!

turf212 commented 2 days ago

The instant emails which get sent to the user should get sent to their manager(s) if the User course completion email template is switched on for the managers. This isnt the same as the digest emails (and has no bearing on the settings for the certificate either). If you are using the IOMAD certificate it will automatically get attached to the user's course completed email and the manager CC'd if the template is on for them.

In the DB is disabledmanager as the column.

dallenk commented 2 days ago

image Does this look correct?

 select companyid,name,disabled,disabledmanager from mdl_email_template where disabled=1;
+-----------+----------------------------------+----------+-----------------+
| companyid | name                             | disabled | disabledmanager |
+-----------+----------------------------------+----------+-----------------+
|        10 | admin_deleted                    |        1 |               1 |
|        10 | advertise_classroom_based_course |        1 |               1 |
|        12 | admin_deleted                    |        1 |               1 |
|        12 | advertise_classroom_based_course |        1 |               1 |
|        13 | admin_deleted                    |        1 |               1 |
|        13 | advertise_classroom_based_course |        1 |               1 |
|         9 | admin_deleted                    |        1 |               1 |
|         9 | advertise_classroom_based_course |        1 |               1 |
|        11 | admin_deleted                    |        1 |               1 |
|        11 | advertise_classroom_based_course |        1 |               1 |
|         8 | admin_deleted                    |        1 |               1 |
|         8 | advertise_classroom_based_course |        1 |               1 |
|         6 | advertise_classroom_based_course |        1 |               1 |
|         7 | advertise_classroom_based_course |        1 |               1 |
|        18 | advertise_classroom_based_course |        1 |               1 |
|        16 | advertise_classroom_based_course |        1 |               1 |
|        25 | advertise_classroom_based_course |        1 |               1 |
|        28 | advertise_classroom_based_course |        1 |               1 |
|        23 | advertise_classroom_based_course |        1 |               1 |
|        14 | advertise_classroom_based_course |        1 |               1 |
|        17 | advertise_classroom_based_course |        1 |               1 |
|        29 | advertise_classroom_based_course |        1 |               1 |
|        19 | advertise_classroom_based_course |        1 |               1 |
|        24 | advertise_classroom_based_course |        1 |               1 |
|        21 | advertise_classroom_based_course |        1 |               1 |
|         3 | advertise_classroom_based_course |        1 |               1 |
|        26 | advertise_classroom_based_course |        1 |               1 |
|         1 | advertise_classroom_based_course |        1 |               1 |
|         4 | advertise_classroom_based_course |        1 |               1 |
|        15 | advertise_classroom_based_course |        1 |               1 |
|         2 | advertise_classroom_based_course |        1 |               1 |
|         5 | advertise_classroom_based_course |        1 |               1 |
|        27 | advertise_classroom_based_course |        1 |               1 |
|        22 | advertise_classroom_based_course |        1 |               1 |
+-----------+----------------------------------+----------+-----------------+
34 rows in set (0.002 sec)

MariaDB [db_sandbox_domain_ca]> select name,disabled,disabledmanager from mdl_email_templateset_templates where disabled=1;
+----------------------------------+----------+-----------------+
| name                             | disabled | disabledmanager |
+----------------------------------+----------+-----------------+
| admin_deleted                    |        1 |               1 |
| advertise_classroom_based_course |        1 |               1 |
| advertise_classroom_based_course |        1 |               1 |
+----------------------------------+----------+-----------------+
3 rows in set (0.000 sec)
dallenk commented 2 days ago

ahh.. this might be it then?

 select name,disabled,disabledmanager from mdl_email_templateset_templates where disabled=1 or disabledmanager=1;
+-----------------------------------+----------+-----------------+
| name                              | disabled | disabledmanager |
+-----------------------------------+----------+-----------------+
[stuff]
| course_completed_manager          |        0 |               1 |
[more stuff]
dallenk commented 2 days ago

this is odd.. seems to be displaying different info on the web vs db. image

Am I looking for the correct name?

select companyid,name,disabled,disabledmanager from mdl_email_template where name='course_completed_manager';
+-----------+--------------------------+----------+-----------------+
| companyid | name                     | disabled | disabledmanager |
+-----------+--------------------------+----------+-----------------+
|        10 | course_completed_manager |        0 |               1 |
|        12 | course_completed_manager |        0 |               1 |
|        13 | course_completed_manager |        0 |               1 |
|         9 | course_completed_manager |        0 |               1 |
|        11 | course_completed_manager |        0 |               1 |
|         8 | course_completed_manager |        0 |               1 |
|        20 | course_completed_manager |        0 |               0 |
|         6 | course_completed_manager |        0 |               1 |
|         7 | course_completed_manager |        0 |               1 |
|        18 | course_completed_manager |        0 |               1 |
|        16 | course_completed_manager |        0 |               1 |
|        25 | course_completed_manager |        0 |               1 |
|        28 | course_completed_manager |        0 |               1 |
|        23 | course_completed_manager |        0 |               1 |
|        14 | course_completed_manager |        0 |               1 |
|        17 | course_completed_manager |        0 |               1 |
|        29 | course_completed_manager |        0 |               1 |
|        19 | course_completed_manager |        0 |               1 |
|        24 | course_completed_manager |        0 |               1 |
|        21 | course_completed_manager |        0 |               1 |
|         3 | course_completed_manager |        0 |               1 |
|        26 | course_completed_manager |        0 |               1 |
|         1 | course_completed_manager |        0 |               1 |
|         4 | course_completed_manager |        0 |               1 |
|        15 | course_completed_manager |        0 |               1 |
|         2 | course_completed_manager |        0 |               1 |
|         5 | course_completed_manager |        0 |               1 |
|        27 | course_completed_manager |        0 |               1 |
|        22 | course_completed_manager |        0 |               1 |
+-----------+--------------------------+----------+-----------------+
29 rows in set (0.002 sec)

MariaDB [db_sandbox_domain_ca]> select id,name,disabled,disabledmanager from mdl_email_templateset_templates where name='course_completed_manager';
+----+--------------------------+----------+-----------------+
| id | name                     | disabled | disabledmanager |
+----+--------------------------+----------+-----------------+
| 19 | course_completed_manager |        0 |               1 |
| 64 | course_completed_manager |        0 |               1 |
+----+--------------------------+----------+-----------------+
2 rows in set (0.000 sec)
turf212 commented 2 days ago

You are indeed looking at the wrong one. The one you are looking for is the User course completion template.

User templates get 3 columns, first is overall is it enabled, second is do we also send this to their manager and last is - if there is a company field which is set up to be used for a supervisor email address, and that email address is valid, then we also send it to that email address. (This last one is in case someone has a manager that isn't on the system but needs to get that specific users emails - or they are on the system and you only want t going to one manager and not all of them)

image

On the other hand, the manager emails just have the enabled/disabled switch:

image

dallenk commented 1 day ago

hrm.. I don't know why the managers don't get these emails, i do have that option selected but only the user is receiving it. Is there any debug code I can add to see what's happening? image

Is there still something I need to enable/change? this was an copy of the production system, and upgraded on the sandbox server.

I'm confused lol

turf212 commented 22 hours ago

If you check the outgoing email report there will be one for the user and another for the manager created at the same time. So if you search for that email template and sort it by times there will be two created and sent (or more if there are more managers for that user) at the same time. Or you can check in the DB as well for the user/course event and if there were any others sent with it.