juftin / camply

camply, the campsite finder ⛺️ - a tool to find campsites at sold out campgrounds through sites like recreation.gov
https://juftin.com/camply/
MIT License
445 stars 85 forks source link

Start and End Date Windows do not behave as expected #351

Open boydthomson opened 3 weeks ago

boydthomson commented 3 weeks ago

When searching for availability within a range of dates, zero results are returned unless start and end dates are for the specific dates available.

Example: camply --debug --provider goingtocamp campsites --rec-area 12 --start-date 2024-07-17 --end-date 2024-08-20 --campground -2147483534 --equipment 0 tent --nights 2 returns: [2024-06-23 17:37:49] DEBUG https://camping.bcparks.ca:443 "GET
/api/availability/map?mapId=-2147483405&resourceLocationId=-2147483534&bookingCategoryId=0&startDate=2024-07-17&endDate=2024 -08-20&isReserving=True&getDailyAvailability=False&partySize=1&numEquipment=1&equipmentCategoryId=-32768 HTTP/1.1" 200 2664 [2024-06-23 17:37:49] INFO ❌ ❌ ❌ ❌ 0 Reservable Campsites Matching Search Preferences

However: camply --debug --provider goingtocamp campsites --rec-area 12 --start-date 2024-07-17 --end-date 2024-07-20 --campground -2147483534 --equipment 0 tent --nights 2

will return: [2024-06-23 17:47:49] DEBUG https://camping.bcparks.ca:443 "GET
/api/availability/map?mapId=-2147483405&resourceLocationId=-2147483534&bookingCategoryId=0&startDate=2024-07-17&endDate=2024 -07-20&isReserving=True&getDailyAvailability=False&partySize=1&numEquipment=1&equipmentCategoryId=-32768 HTTP/1.1" 200 2664 [2024-06-23 17:47:49] DEBUG https://camping.bcparks.ca:443 "GET /api/attribute/filterable HTTP/1.1" 200 46622
[2024-06-23 17:47:49] DEBUG https://camping.bcparks.ca:443 "GET /api/resource/details?resourceId=-2147475362 HTTP/1.1" 200 1347
[2024-06-23 17:47:49] INFO ⛺️ ⛺️ ⛺️ ⛺️ 1 Reservable Campsites Matching Search Preferences
[2024-06-23 17:47:49] INFO 📅 Wed, July 17 🏕 1 sites
[2024-06-23 17:47:49] INFO ⛰️ BC Parks 🏕 Skagit Valley Provincial Park: ⛺ 1 sites
[2024-06-23 17:47:49] INFO 🔗
https://camping.bcparks.ca/create-booking/results?mapId=-2147483405&bookingCategoryId=0&startDate=2024-07-17&endDate=2024-07 -20&isReserving=true&equipmentId=-32768&subEquipmentId=&partySize=1&resourceLocationId=-2147483534 (3 nights)

So do I need to write something to loop through dates in order to find any 3-night window within my desired dates?

camply --debug campsites \
    --campground 232338 \
    --start-date 2023-09-09 \
    --end-date 2023-09-32 \
    --nights 3

Additional context

< Add any other context about the problem here. >

juftin commented 3 weeks ago

😞 GoingToCamp has been experiencing some major issues lately - I believe their API responses are changing and the provider probably needs a full re-write. I'll dig into this and post any further updates here