Wunderbyte-GmbH / moodle-mod_booking

Moodle Booking Module
https://www.wunderbyte.at
21 stars 39 forks source link

Question on "feature-berta" and courseid and booking rules #551

Closed semteacher closed 2 months ago

semteacher commented 3 months ago

Question was inspiried by message

Image

  1. At this moment most of tests on rules had failed. 1.1 Some of them because of typo changes in the log text. So could be fixed relatively easy (will be done soon) 1.2 But it looks like an additional messages appears... For example for the Scenario: Booking option: send custom reminder mail to participant

Image

(2 such messages for each student)

Another example is the Scenario: Booking rule for: copy to relateduser a custom message sent to users who booked option

Image

Image

(different IDs because of 2 test passes have been used to take screens in this case )

Similar case for the most of the rules tests... Question. Does it is correct? (Sorry I amslightly lost in amount of messages has to be sent)

2, Clarification. If I clearly understand "if courseif present - only teacher has been subscribed to option" so students are not? and they should not receive any messages? But in case of rules - it has to be an "override"? Or I do not understand current logick of subscription / messaging? Please, clarify/explain correct logick of this.

  1. Important general qurestion For a long time Behat tests contains declaration of options like

Image

Moreover, "course" was a mandatory element of declaration of options. Hovewer, relatively recently to achieve a course connection like

Image

It will be necessary to have declaration of option like

Image

But after dealing with course connection task and because of top message and be re-checking option settings of old oprions in the DB of dev I use - I conclude that it rather more common case when option does not have a connected course. Am I correct? It was not pointed nor discussed before but it seems like very important matter?
So

semteacher commented 3 months ago

An additional questions related to points 1 and 2 above: Behat Scenario: Booking rules: create booking rule for teacher substituing event Expexting email to admin being semt

Image

And I should see "An e-mail with subject 'teacher subst' has been sent to user with id: '2'"

But only the following email has been sent

Image

I have to know is it expected canges in behavior now? (But it will means that booking rules no longer applicable?)

The same case with behat Scenario: Booking rules: create booking rule for option cancellation event and notify students Expecting message being sent to students

Image

but actually in the logs I see a message(s) had been sent from students to teacher

Image

(Or am I wrong?)

Next: behat Scenario: Booking rules: create booking rule for teacher removal event and notify other teachers

Image

there are 3 teachers initially: teacher2, teacher1, admin. Teacher 2 has been removed.

Previously I expected and had seen an atleast the email to remaining teacher (admin)

And I should see "An e-mail with subject 'teacher removed' has been sent to user with id: '2'"

Now I see 3 emails:

Image

Image

Image

_The last one rule on the "401testing" branch looks like this:

Image

Image

Image

georgmaisser commented 3 months ago

Hi, I didn't do it on my system now, but a few ground rules:

Actually, I have the impression that as for your first tests, everything ist fine. When you have a rule, which sends a mail when a custom mail is sent, you would expect two messages, when one is sent. First the initial message, then the one from the rule.

As for the second point: There was a change indeed. Please be aware of the following points.

In all cases except A) the courseid of the connected course will be stored. On reloading the booking option, the selector will be set on Option B), as the newly created course from Option C & D will then just be an existing course.

georgmaisser commented 3 months ago

Back to the messages:

I guess we need to be careful not to create a loop, where the reaction to a sent message will trigger another reaction to the newly sent message.

I think the intended logic is clear.

semteacher commented 3 months ago
semteacher commented 3 months ago

Image

Image

semteacher commented 3 months ago

Option being updated without errors. But it look like that "bookingoption_updated" even not being fired at all. Cannot intercept nothing with the following breakpoints:

Image

UPD. Fixed there https://github.com/Wunderbyte-GmbH/moodle-mod_booking/commit/3f001db6b12b6db6c73dbbbd2b884b5543c88b0e along with Teacher/course dependency

georgmaisser commented 3 months ago

The "Start" button is intended behaviour, why do you think it's not? You see in the code the "get_config" call and it's linked to this setting. If you take away the checkbox, it would be the old behaviour again.

Bildschirmfoto 2024-06-30 um 09 21 34
georgmaisser commented 3 months ago

Failed behat Scenario: Booking rules: create booking rule for option update and notify teachers about it Option being updated without errors. But it look like that "bookingoption_updated" even not being fired at all. Cannot intercept nothing with the following breakpoints:

Please describe the problem again, I don't understand what you mean.

semteacher commented 3 months ago

The "Start" button is intended behaviour, why do you think it's not? You see in the code the "get_config" call and it's linked to this setting. If you take away the checkbox, it would be the old behaviour again.

Bildschirmfoto 2024-06-30 um 09 21 34

Have fixed ENG string and adjusted 4 behat tests to support it. One of them modified to support new approach ("linktomoodlecourseonbookedbutton" is "ON" so only "Start" link to the connected course being shown) other 3 still set to old way ("linktomoodlecourseonbookedbutton" is "OFF", so "Booked" label and "Go to course" link to the connected course being shown)

semteacher commented 3 months ago

Failed behat Scenario: Booking rules: create booking rule for option update and notify teachers about it Option being updated without errors. But it look like that "bookingoption_updated" even not being fired at all. Cannot intercept nothing with the following breakpoints:

Please describe the problem again, I don't understand what you mean.

Fixed there https://github.com/Wunderbyte-GmbH/moodle-mod_booking/commit/3f001db6b12b6db6c73dbbbd2b884b5543c88b0e along with Teacher/course dependency