Migrated from Redmine #1168 | Author: Kamalesh Suryawanshi
Status: Feedback | Priority: High, I’m very impatient | Created: 2024-02-19
from Lars Ekman
We are getting some weird results from the REST API that we would like to understand better. Here is a request to the /admin/schedule endpoint on subsystem *test:
https://user-api-v2.enterpriseappointments.com/admin/schedule?date_from=2023-12-23&date_to=2023-12-24&service_id=4&provider_id[]=3
[
{
“id”: “2023-12-23”,
“date”: “2023-12-23”,
“time_from”: “00:00:00”,
“time_to”: “00:00:00”,
“is_day_off”: true
},
{
“id”: “2023-12-24”,
“date”: “2023-12-24”,
“time_from”: “22:00:00”,
“time_to”: “23:00:00”,
“is_day_off”: false
}
]
Notice how the results between the two days are different. December 23 (a Saturday) has time_from and time_to set to 00:00 and is_day_off: true. But December 24 (a Sunday) has a time_from and time_to set to 22:00 and 23:00 with is_day_off: false.
However, the special day settings for this provider are identical on December 23 and December 24 (working 22:00 to 23:00). Nor are there any special days set on the service or company level. So why are the results different?
To give another example, the following request gets the schedule for December 26 and December 27 (a Tuesday and Wednesday). These provider special days also have same settings as December 23 and December 24. For these days there is no difference:
https://user-api-v2.enterpriseappointments.com/admin/schedule?date_from=2023-12-26&date_to=2023-12-27&service_id=4&provider_id[]=3
[
{
“id”: “2023-12-26”,
“date”: “2023-12-26”,
“time_from”: “00:00:00”,
“time_to”: “00:00:00”,
“is_day_off”: true
},
{
“id”: “2023-12-27”,
“date”: “2023-12-27”,
“time_from”: “00:00:00”,
“time_to”: “00:00:00”,
“is_day_off”: true
}
]
So it seems Sundays is somehow treated differently. But we can’t find any setting (special days schedule or otherwise) on the service, service provider or company level that would explain this behavior.
To confirm we set up the same identical special days on January 6 and January 7 (a Saturday and Sunday). Once again the Sunday is different from the Saturday:
https://user-api-v2.enterpriseappointments.com/admin/schedule?date_from=2024-01-06&date_to=2024-01-07&service_id=4&provider_id[]=3
[
{
“id”: “2024-01-06”,
“date”: “2024-01-06”,
“time_from”: “00:00:00”,
“time_to”: “00:00:00”,
“is_day_off”: true
},
{
“id”: “2024-01-07”,
“date”: “2024-01-07”,
“time_from”: “22:00:00”,
“time_to”: “23:00:00”,
“is_day_off”: false
}
]
Is this a bug in the REST API, or is there some setting we’re missing?