[#947] getAvailableUnits API returns unavailable providers

Migrated from Redmine #947 | Author: Leonardy Huang
Status: Closed | Priority: Immediate, there is BUG! | Created: 2022-10-19


Hello,

Our configurations:

  • We have services (duration: 80 minutes) with possible add-ons (duration: 40 minutes per add-on) starting from 09:00 - 18:00
  • 1 service provider can only handle 1 client at a time

h2. What happened

There was an appointment with let’s say 7 addons at 09:00, and a service provider was already booked at 10:20 - 11:40. The booking duration was supposed to be 80 + 40*7, or 360 minutes. But this provider was still considered available (getAvailableUnits function returned this provider) thus the booking was attempted and it returned “Selected time not available” error.

h2. Expectation

getAvailableUnits function was not supposed to return this service provider since he was already booked within the duration of 360 minutes

This function was working fine before, but now the behavior was not the same.

Sample request:


curl --location --request POST 'https://user-api.simplybook.vip' \
--header 'X-Company-Login: acompany' \
--header 'X-Token: atoken' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getAvailableUnits",
    "params": [
        4,
        "2022-10-21 09:00:00",
        null,
        null,
        [
            1,
            1,
            1,
            1,
            1,
            1,
            1
        ]
    ],
    "id": 1
}'

Sample response (service provider 11 is the one that was not available):


{
    "result": [
        14,
        3,
        7,
        4,
        12,
        13,
        6,
        11,
        8,
        5,
        2,
        1,
        9
    ],
    "id": "1",
    "jsonrpc": "2.0"
}

Kindly assist.

Screenshot:
!https://i.ibb.co/K2CnhyS/screencapture-malaysiatest2-secure-simplybook-vip-v2-2022-10-19-16-43-14.png!

Redmine Admin wrote:

hi, addons does not support multiple quantity, only one addon with same id per booking is supported.

Leonardy Huang wrote:

Redmine Admin wrote:

hi, addons does not support multiple quantity, only one addon with same id per booking is supported.

Hi,

It has been working fine for a few months before.

Also, if it is a single addon only, the function should not return that particular provider as available because the duration would be 120 minutes (he only had 80 minutes), right?

Thanks.

Redmine Admin wrote:

As we can see on your screenshot, this provider has 2 hours of availability and should be returned by this method

Redmine Admin wrote:

Seems this slot should not be available. please provide your company login

Leonardy Huang wrote:

Redmine Admin wrote:

Seems this slot should not be available. please provide your company login

Yes, because he was only available for 80 minutes from 09:00 - 10:20. The company login is: https://malaysiatest2.secure.simplybook.vip/.

Thanks.

Val Komarov wrote:

Add-ons duration is added to event duration only for those add-ons which are connected to selected service, or not connected to any services.
There is no connection between add-on 1 and service 4 in your database, and, furthermore, service 4 is deleted

Leonardy Huang wrote:

Val Komarov wrote:

Add-ons duration is added to event duration only for those add-ons which are connected to selected service, or not connected to any services.
There is no connection between add-on 1 and service 4 in your database, and, furthermore, service 4 is deleted

My apology, what I meant was service id 5. And the issue seems resolved now. You can close this ticket, thanks for the asisstance.