Wunderbyte-GmbH / moodle-mod_booking

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

Create behat test for askforconfirmation #446

Closed georgmaisser closed 3 months ago

georgmaisser commented 5 months ago
Bildschirmfoto 2024-03-21 um 16 34 48
semteacher commented 4 months ago

At least 2 potential issues (occured on my dev, not confirmed at other instances):

  1. Incorrect value 0 of totalrecord param of the table oblect could be faced in some circumstances (or environment configs) related to the following code in the query_db_cached() method of wunderbyte_table class of wb_talbe plugin. if (!$paginationset) { $this->totalrecords = $DB->count_records_sql($totalcountsql, $this->sql->params); $this->set_pagination_to_cache($cachekey); }

if $paginationset == true $totalrecords not updated and remains == 0...

  1. Additionally, the following behavoral issue could be observed in some circumstances (or environment configs) https://screenrec.com/share/EWj8ZxzqAl
georgmaisser commented 4 months ago

Hi Andrii, just to be sure: The issues above are solved, no?

semteacher commented 4 months ago

@georgmaisser I will need pull latest changes and to check again. But at least on Sunday I still had problem with waiting list on my dev.

semteacher commented 4 months ago

@georgmaisser I have made an additional debugging... Noticed that when I vizit ""book other user" page the query_db_cached() method of wunderbyte_table class of wb_talbe plugin called TWICE in a row.

"SELECT COUNT(1) FROM (SELECT ba.id, u.id as userid, u.firstname, u.lastname, u.email, ba.timemodified, ba.timecreated, ba.optionid, ba.json FROM {booking_answers} ba JOIN {user} u ON ba.userid = u.id WHERE ba.optionid=:optionid AND ba.waitinglist=:statusparam ORDER BY ba.timemodified, ba.id ASC ) s1 WHERE 1=1 "

optionid: 261 statusparam: 2

$total = $grandtotal = 0 $this->rawdata = 0

$this->totalrecords = 0

Such as $paginationset = false  $this->set_pagination_to_cache has been executed so totalrecords = 0 cached

- 2nd pass

$this->cachecomponent = "mod_booking" $this->rawcachename = "bookedusertable" $cachekey = "488148699_sqlquery" $paginationset = true (!!!)

"SELECT COUNT(1) FROM (SELECT ba.id, u.id as userid, u.firstname, u.lastname, u.email, ba.timemodified, ba.timecreated, ba.optionid, ba.json FROM {booking_answers} ba JOIN {user} u ON ba.userid = u.id WHERE ba.optionid=:optionid AND ba.waitinglist=:statusparam ORDER BY ba.timemodified, ba.id ASC ) s1 WHERE 1=1 "

optionid: 261 statusparam: 1

$total = $grandtotal = 2 $this->rawdata = array(2)

$this->totalrecords = 0 (ERROR!)


Such  as $paginationset = true  $this->set_pagination_to_cache has NOT been executed so totalrecords = 0 remains in cache abd used despite 2 records available,

Could 2 pass be related to 2 rows there:

![Image](https://github.com/Wunderbyte-GmbH/moodle-mod_booking/assets/1571998/5eda78d9-e405-4c5e-838e-f29add6ba18f)

but I cannot figure-out  what setting is responsible for "Users with short reservations"
bernhard-wunderbyte commented 4 months ago

"Users with shortterm reservations" are users who currently have the item in their shopping cart.

semteacher commented 4 months ago

@bernhard-wunderbyte Tnahk you for above clarification. How about 2 passes for waitinglist with differnt statuscodes? If 2 different datasets expected (by statusparam)- why 1 cache had been used?

bernhard-wunderbyte commented 4 months ago

@georgmaisser Can you help @semteacher with this?

semteacher commented 4 months ago

(above commit related to another issue and had updated already)

semteacher commented 3 months ago

Finally working on my dev env. too