Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions camply/containers/gtc_api_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ class ResourceLocation(CamplyModel):
resource_location_id: Optional[int]
resource_location_name: str
region_name: str
root_map_id: Optional[int]
26 changes: 19 additions & 7 deletions camply/providers/going_to_camp/going_to_camp_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,19 @@ def get_site_details(self, rec_area_id: int, resource_id: int):
)
attribute_details = self._attribute_details

site_details = self._api_request(
rec_area_id, "SITE_DETAILS", {"resourceId": resource_id}
)
try:
site_details = self._api_request(
rec_area_id, "SITE_DETAILS", {"resourceId": resource_id}
)
except ConnectionError:
return {
"resourceId": resource_id,
"localizedValues": [{"name": f"Site {resource_id}"}],
"minCapacity": 1,
"maxCapacity": 1,
"definedAttributes": [],
"site_attributes": {},
}
site_attributes = {}
for attribute in site_details["definedAttributes"]:
attribute_detail = attribute_details[
Expand Down Expand Up @@ -387,6 +397,7 @@ def _filter_facilities_responses(
resource_categories=facil.get("resourceCategoryIds"),
resource_location_id=facil.get("resourceLocationId"),
resource_location_name=location_name,
root_map_id=facil.get("rootMapId"),
)
except ValidationError as ve:
logger.error("That doesn't look like a valid Campground Facility")
Expand Down Expand Up @@ -424,10 +435,11 @@ def _process_facilities_responses(
-------
Tuple[dict, CampgroundFacility]
"""
self.campground_details[facility.resource_location_id]
facility.id = _fetch_nested_key(
self.campground_details, facility.resource_location_id, "mapId"
)
facility.id = facility.root_map_id
if facility.id is None:
facility.id = _fetch_nested_key(
self.campground_details, facility.resource_location_id, "mapId"
)
if facility.region_name:
formatted_recreation_area = (
f"{rec_area.recreation_area}, {facility.region_name}"
Expand Down