Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add campsite search by exact date windows #297

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sethgirvan
Copy link

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:

  • I've read the contributing guidelines of this project
  • I've installed and used .pre_commit on all my code
  • I have documented my code, particularly in hard-to-understand areas
  • I have made any necessary corresponding changes to the documentation

Use with the `--exact-windows` flag to `camply campsites`
@juftin
Copy link
Owner

juftin commented Sep 14, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants