Wunderbyte-GmbH / moodle-mod_booking

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

Test Track Changes Feature #535

Closed eynimeni closed 2 weeks ago

eynimeni commented 4 weeks ago

I have made a screenrecording explaining the new feature changes that tracks changes in updated bookingoptions. there is a new placeholder {changes} in the rules that will replace the mailtemplates in the future. could you please a) have a look at the failing actions ins the branch: track_changes_in_boform and b) write tests about this new feature

here are the recordings. Let me know if anything is unclear. https://we.tl/t-Mk88AUK8LF

Behat tests:

=========================== phpunit tests

semteacher commented 3 weeks ago

Bug: I have changed teacher for option but it does not registerd under "recent changes". Instead this has been added

Image

semteacher commented 3 weeks ago

@eynimeni about "Still use legacy mail templates ( booking | uselegacymailtemplates )" feature It works now significantly differnt than in your video (2nd recording). With negation of settings there

Image

I can see "deprecated templates" only plugin setting unchecked

Image

Moreover I see category and editboxes for messages under booking settings - not under option settings

Image

This part under option settings always the same

Image

Please, verify how and where this has to work

semteacher commented 3 weeks ago

Image

Despite all my attempts to fix (commit not in "origin" repo)

Image

Still got the same error

Image

eynimeni commented 3 weeks ago

@eynimeni about "Still use legacy mail templates ( booking | uselegacymailtemplates )" feature It works now significantly differnt than in your video (2nd recording). With negation of settings there

Image

I can see "deprecated templates" only plugin setting unchecked

Image

Moreover I see category and editboxes for messages under booking settings - not under option settings

Image

This part under option settings always the same

Image

Please, verify how and where this has to work

Yes! Sorry for that. I misunderstood what was deprecated and made the screenrecording with the old version and forgot to give you the update. Correct behaviour is implemented now. Find deprecated forms in:

In the settings of a bookinoption NO deprecation warning and display always.

semteacher commented 3 weeks ago

@eynimeni By writing phpunit tests I found number of occurences like this in the list of recorded changes

Image

I think that change of kind of empty value should not being registered as change. OR @georgmaisser - should we standartize defaults between bookig_option::create() and bookig_option::update() ?

semteacher commented 3 weeks ago

A potential issue with dates processing for changes exist. At github option dates not being assigned at option creation all the time.

Image

Image

UPD: additional test run at github with var_dump

Image

eynimeni commented 2 weeks ago

remaining problem see #545

semteacher commented 2 weeks ago

During debugging of phpunit faced the following error when tried to use {changes} placeholder in the email template: 1) mod_booking\rules_test::test_rule_on_teacher_added Error: Object of class stdClass could not be converted to string

/var/www/html/lib/mustache/src/Mustache/Template.php:66 /var/www/html/lib/outputrenderers.php:208 /var/www/html/mod/booking/classes/output/renderer.php:491 /var/www/html/mod/booking/classes/event/bookingoption_updated.php:83 /var/www/html/mod/booking/classes/placeholders/placeholders/changes.php:84 /var/www/html/mod/booking/classes/placeholders/placeholders_info.php:115 /var/www/html/mod/booking/classes/message_controller.php:327 /var/www/html/mod/booking/classes/message_controller.php:272 /var/www/html/mod/booking/classes/task/send_mail_by_rule_adhoc.php:107 /var/www/html/lib/phpunit/classes/advanced_testcase.php:722 /var/www/html/mod/booking/tests/booking_rules/rules_test.php:147 /var/www/html/lib/phpunit/classes/advanced_testcase.php:81 Error has been raised just at renderring

Image

debugger tried to create a file

Image

During manual tests no error occurs...

semteacher commented 2 weeks ago

above fixed there https://github.com/Wunderbyte-GmbH/moodle-mod_booking/commit/422ed09332d7f4eaa4602e17d8542ca598103f4d https://github.com/Wunderbyte-GmbH/moodle-mod_booking/commit/1f1c57a4b51f12bc98916b2c0f9083c29abb064b