Wunderbyte-GmbH / moodle-mod_booking

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

Booking options show in wrong booking #308

Closed jharej closed 1 year ago

jharej commented 1 year ago

Describe the bug We've discovered that when searching for a booking option within one booking, the search results display booking options from another unrelated booking. Our platform is used for booking seminars, where each booking represents an individual seminar and each booking option signifies a specific session of that seminar (e.g., at a particular location and time). While testing the new version, browsing through booking options functions correctly, but the search feature does not behave as expected.

Versions uses Moodle version: $release = '4.1.2+ (Build: 20230406)'; Boooking version: $plugin->release = '8.0.20'; wunderbyte table version: $plugin->release = '1.6.9'; $plugin->version = 2023081100;

To Reproduce Click on booking number one. Utilize the search function and observe that only the booking options from this specific booking are displayed – this is the correct behavior. Return to the main course page and select a different booking, for instance, booking number two within the same course. Employ the search function and input the name of a booking option from booking number one. Observe that the search results include the list of booking options from booking number one, which is unexpected behavior.

Expected behavior When using the search option within booking number two, the expected outcome is not to receive any results related to booking options from booking number one.

dasistwas commented 1 year ago

We are now at v8.0.31 Could you check if that is still a problem?

atlet commented 1 year ago

Ok, I upgraded to v8.0.31, but no I'm getting this error:

2023-08-30_10-20

How to fix this issue?

dasistwas commented 1 year ago

Could you provide the steps to reproduce this error? Could you also purge the caches?

atlet commented 1 year ago

I cleared the cache and it's the same. I updated to v8.0.31 and this error pops out when I go to /mod/booking/view.php?id=XXXX address. I suspect naming of cache as we have č char in it.

atlet commented 1 year ago

So, the problem is with wunderbyte_table. If I add in file classes/wunderbyte_table.php in line 900 this $key = str_replace(['č', 'ž', 'š', 'Č', 'Ž', 'Š'], ['c', 'z', 's', 'C', 'Z', 'S'], $key); it's working fine.

atlet commented 1 year ago

can you fix this please.

dasistwas commented 1 year ago

Where did you include the special characters in booking? In the booking option name? We would be happy if you give us some hints how we can reproduce the error on our systems.

atlet commented 1 year ago

In my institution. 2023-08-30_14-34

dasistwas commented 1 year ago

I tried to reproduce: On my machine it works. See the video

Screencast from 2023-08-30 14-49-15.webm

dasistwas commented 1 year ago

What is your PHP version and database used?

atlet commented 1 year ago

I'm using PostgreSQL and php is version 7.4.3

bernhard-wunderbyte commented 1 year ago

I fixed this with commit f6e1e68267bd5d425b80402e8e0e4e91997432bf. It's already part of Booking 8.0.33 - you can get it here: https://github.com/Wunderbyte-GmbH/moodle-mod_booking/tags