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

🐛 goingtocamp missing sites #293

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

juftin
Copy link
Owner

@juftin juftin commented Sep 1, 2023

Description

Resolves #291

This PR makes a few changes:

  1. Allows for campsites to have a null minCapacity - it gets replaced with 0 now
  2. No longer uses NON_GROUP_EQUIPMENT in every API request. By default, no equipment type is requested.

Has This Been Tested?

Yes - all snapshots needed to be recreated because we're passing different API params

@@ -175,7 +175,7 @@ def get_all_campsites(self) -> List[AvailableCampsite]:
# be viable for camping. Skip all zero-capacity sites.
if (
not site_details["minCapacity"]
or not site_details["maxCapacity"]
and not site_details["maxCapacity"]
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's where we allow sites with a maxCapacity, but not a minCapacity, to get selected

Comment on lines +542 to +548
search_filter.equipmentCategoryId = NON_GROUP_EQUIPMENT
search_filter.subEquipmentCategoryId = equipment_type_id
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's where we only use the equipmentCategoryId when subEquipmentCategoryId is also used.

Copy link
Contributor

@acaloiaro acaloiaro Sep 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the bug that "group sites" were ending up in the result set?

Assuming equipment_type_id is a non-group equipment type, the addition of the NON_GROUP_EQUIPMENT filter seems like it should be superfluous here.

@juftin juftin changed the title Fix/going to camp missing sites 🐛 goingtocamp missing sites Sep 1, 2023
Copy link
Contributor

@acaloiaro acaloiaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. Although I have one question out of curiosity: https://github.com/juftin/camply/pull/293/files#r1313768409

@spraot
Copy link

spraot commented Feb 8, 2024

This should be merged!

@juftin juftin force-pushed the fix/going_to_camp_missing_sites branch from 3bf16ef to 270d051 Compare February 22, 2024 15:52
@juftin
Copy link
Owner Author

juftin commented Feb 23, 2024

I'm not actually sure GoingToCamp is working as expected, with or without this change. For example, this command currently returns 7 sites:

camply campsites --provider GoingToCamp --campground -2147483565 --start-date 2024-05-23 --end-date 2024-05-24 --rec-area 14 --notifications silent --debug
image

However these 7 sites are all included in the Group Campsite Area, and omitting the #1-94 area which has at least 1 available. I believe there's an issue with enumerating all MapIDs / Locations to search and some areas aren't included.

@yashshah
Copy link

yashshah commented May 21, 2024

Are there any updates here? I am seeing the same when running:

❯   camply campsites \
  --provider goingtocamp \
  --rec-area 14 \
  --notifications ntfy \
  --campground -2147483565 \
  --start-date 2024-05-28 \
  --end-date 2024-05-29 \
  --polling-interval 10 \
  --search-forever --debug
[2024-05-20 22:38:27] CAMPLY   camply, the campsite finder ⛺️
[2024-05-20 22:38:27] DEBUG    Setting up camply debugging
[2024-05-20 22:38:27] DEBUG    Camply Version: 0.32.6
[2024-05-20 22:38:27] DEBUG    Python Version: 3.10.9
[2024-05-20 22:38:27] DEBUG    Platform: darwin
[2024-05-20 22:38:27] INFO     Using Camply Provider: "GoingToCamp"
[2024-05-20 22:38:27] INFO     1 booking nights selected for search, ranging from 2024-05-28 to 2024-05-28
[2024-05-20 22:38:27] INFO     Retrieving Facility Information for Recreation Area ID: `14`.
[2024-05-20 22:38:27] DEBUG    Starting new HTTPS connection (1): reservation.pc.gc.ca:443
[2024-05-20 22:38:27] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/resourceLocation HTTP/1.1" 200 288380
[2024-05-20 22:38:28] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/maps HTTP/1.1" 200 4227616
[2024-05-20 22:38:28] INFO     1 Matching Campgrounds Found
[2024-05-20 22:38:28] INFO     ⛰  Parks Canada (#14) - 🏕  Pacific Rim - Green Point (#-2147483565)
[2024-05-20 22:38:28] INFO     Searching for campsites every 10 minutes.
[2024-05-20 22:38:28] INFO     Notifications active via: <SilentNotifications>, <NtfyNotifications>
[2024-05-20 22:38:29] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/availability/map?mapId=-2147483313&resourceLocationId=-2147483565&bookingCategoryId=0&startDate=2024-05-28&endDate=2024-05-29&isReserving=True&getDailyAvailability=False&partySize=1&numEquipment=1&equipmentCategoryId=-32768 HTTP/1.1" 200 1353
[2024-05-20 22:38:29] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/attribute/filterable HTTP/1.1" 200 227602
[2024-05-20 22:38:29] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/resource/details?resourceId=-2147480629 HTTP/1.1" 200 3461
[2024-05-20 22:38:29] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/resource/details?resourceId=-2147480555 HTTP/1.1" 200 3463
[2024-05-20 22:38:29] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/resource/details?resourceId=-2147480542 HTTP/1.1" 200 3463
[2024-05-20 22:38:29] DEBUG    https://reservation.pc.gc.ca:443 "GET /api/resource/details?resourceId=-2147480542 HTTP/1.1" 200 3463
[2024-05-20 22:38:29] INFO     ❌ ❌ ❌ ❌ 0 Reservable Campsites Matching Search Preferences

Basically it is not catching all the mapIds and doesn't list available campsites

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.

GoingToCamp Parks Canada does not identify available sites correctly
4 participants