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
486 stars 94 forks source link

✨ Add campsite search by exact date windows #297

Open sethgirvan opened 1 year ago

sethgirvan commented 1 year ago

Use with the --exact-windows flag to camply campsites

Description

I wrote this feature for myself but maybe others would find it useful too. It adds an --exact-windows flag to tell camply to only find a campsite which has an availability matching the entirety of one of the ranges specified between --start-date and --end-date. It is useful when you want to search for multiple date ranges at once, and the minimum number of nights you want to stay for each is different.

For example

camply campsites \
    --rec-area 2991 \
    --start-date 2023-10-08 \
    --end-date 2023-10-10 \
    --start-date 2023-10-15 \
    --end-date 2023-10-18 \
    --exact-windows

Will search for two night availabilities starting 2023-10-08 and three night availabilities starting 2023-10-15, but will not search for two night availabilities between 2023-10-15 and 2023-10-18.

Has This Been Tested?

Tested manually and also added a basic test to tests/cli/test_campsites.py.

Checklist:

juftin commented 1 year ago

Love this, I've mostly just glanced at it but everything looks to be covered here. Thank you very much for the contribution - I will get some additional review on this soon.