-
Notifications
You must be signed in to change notification settings - Fork 57
Availability validation not working? [v5.5] #1449
Comments
Alright I'm on this. |
Ok, strange issue number 1 - I created a clean database, created a reservation starting today through next week for an equipment model with only a single equipment item, and then tried to create a second reservation for said equipment model. I correctly saw the failed availability validation in the flash and in the reservation confirmation. I'm thinking this might have something to do with status; I'm going to see what happens if I check out the first reservation. |
Yup, that's it. Once the reservation has been checked out it no longer factors into the availability equation, even though it is reflected in the number in the catalog. Now to figure out why... |
Looks like we broke this in #1220 (I might have even commented on it at the time), |
HAHAHAHA, this was literally a one-word fix (replacing |
Resolves #1449 - ensures that checked-out reservations are also taken into account
Fix for v5.5 is finished and awaiting review, I'm going to put together a more comprehensive fix for |
Resolves #1449 - replace reserved_in_date_range with overlaps_in_date_range that doesn't take status into account and add active where necessary - add specs for cart availability validation - fix specs for reservation availability validation
Resolves #1449 - replace reserved_in_date_range with overlaps_with_date_range that doesn't take status into account and add active where necessary - add specs for cart availability validation - fix specs for reservation availability validation
Ok, this has been resolved on |
Resolves #1449 - replace reserved_in_date_range with overlaps_with_date_range that doesn't take status into account and add active where necessary - add specs for cart availability validation - fix specs for reservation availability validation
Ok, it turns out that the methods we use to calculate the number of equipment items available are somehow broken, so I'm leaving this open and we'll have to patch v5.5 again next week. While dealing with some client feedback from STC I logged in to see Reservations claiming that there are zero equipment items available despite the fact that there are clearly five of them available when looking at the list. I'm seeing 53 total items, 32 of which are checked out (8 of which are overdue), with 16 items deactivated and 5 left available. Strangely, the JS calendar on the equipment model page shows 4 available, which is also incorrect, so I'm really not sure what's going on. Adding the model to my cart does trigger the cart validation error. This is pretty critical so I'm going to see if I can patch this tonight to squeeze it in tomorrow's deployment (going to be tight). Otherwise we'll push out a critical patch next week to fix this since availability is kinda important. We're really feeling the lack of test coverage here... I'll add that in to |
Figured it out, our code is fine (at least when it comes to evaluating availability), however there were two issues with the STC database. First, there was a single reservation where the equipment item had been deactivated but the reservation had not been checked in (I archived it). I believe that the automatic archiving of reservations after equipment deactivation was only added in #728 so this is a holdover from before the update to v5.5. The second, and more problematic issue, is that #462 added a new boolean attribute for reservations called I'll open a new issue to address this latter problem; unfortunately due to a bug with the old version of Rails Admin we're using we can't edit reservations because of the status enum; I'm going to include an update of that dependency for the patch for v5.5 so we can resolve the issues with the STC instance immediately. |
Whoops, leaving this open to add still-needed tests for |
Resolves #1449 - replace reserved_in_date_range with overlaps_with_date_range that doesn't take status into account and add active where necessary - add specs for cart availability validation - fix specs for reservation availability validation
Reported by BMEC:
Confirmed on BMEC PROD, I can add said overbooked item (or any overbooked item) to my cart (through the equipment model page) and no cart validations are triggered, either in the flash or in the cart warnings. No idea what's going on, this is CRITICAL so we should get this fixed ASAP. If necessary we can push a patch for v5.5.3 over the weekend / early next week and bump the rest of this milestone to v5.5.4.
The text was updated successfully, but these errors were encountered: