Skip to content

Commit

Permalink
Heidelberg: Revert pre-fill of streets and ignore timezone on Christm…
Browse files Browse the repository at this point in the history
…as tree collection parse (#3502)

* Revert "feat(Heidelberg): Pre-fill available streets when using GUI for setup"

This reverts commit 5931e11.

* feat(Heidelberg): Make get_available_streets() function private as public visibility isn't needed anymore

* fix(Heidelberg): Ignore timezones when parsing christmas collecion date
  • Loading branch information
DerDreschner authored Jan 10, 2025
1 parent 1a2d9eb commit 98702f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def __init__(
self._even_house_number = even_house_number

@staticmethod
def get_available_streets() -> list[str]:
def _get_available_streets() -> list[str]:
streets_request = requests.get(STREETNAMES_API_URL)
streets_request.raise_for_status()

Expand All @@ -216,7 +216,7 @@ def _extract_collection_data(self, raw_collection_data):
for waste_type in WASTE_TYPES:
if waste_type == WASTE_TYPES["christmas"]:
collection_date = date_parser.parse(
raw_collection_data[waste_type][0]["collection_date"]
raw_collection_data[waste_type][0]["collection_date"], ignoretz=True
)
ruleset = rruleset()
ruleset.rdate(collection_date)
Expand Down Expand Up @@ -278,7 +278,7 @@ def fetch(self) -> list[Collection]:
raise SourceArgumentRequiredWithSuggestions(
"street",
"It's required to specify your street.",
self.get_available_streets(),
self._get_available_streets(),
)

collections_request = requests.get(self._api_url)
Expand All @@ -287,7 +287,7 @@ def fetch(self) -> list[Collection]:

if len(raw_collection_data["collections"]) == 0:
raise SourceArgumentNotFoundWithSuggestions(
"street", self._street, self.get_available_streets()
"street", self._street, self._get_available_streets()
)

collection_data = self._extract_collection_data(raw_collection_data)
Expand All @@ -306,9 +306,4 @@ def fetch(self) -> list[Collection]:
)
)

return entries


CONFIG_FLOW_TYPES = {
"street": {"type": "SELECT", "values": Source.get_available_streets()}
}
return entries
2 changes: 1 addition & 1 deletion doc/source/heidelberg_de.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ waste_collection_schedule:
### Configuration Variables
**street**
*(string) (required)* The street you want to get the waste collection schedule for. This value must match with an [entry from the API](https://garbage.datenplattform.heidelberg.de/streetnames). If you use the GUI to set up this source, we automatically get all available street names and provide you a drop-down list where you can choose the appropriate entry.
*(string) (required)* The street you want to get the waste collection schedule for. This value must match with an [entry from the API](https://garbage.datenplattform.heidelberg.de/streetnames). If you use the GUI to set up this source and your input doesn't match, we automatically suggest you entries based on the API response.
**collect_residual_waste_weekly**
*(bool)* By default, the city collects residual waste on a weekly basis. If you decided to switch to a bi-weekly schedule to save some money, set this value to False. If you live on a rural street where the waste is only being collected biweekly, you don't need to change anything here as it's being taken into account automatically.
Expand Down

0 comments on commit 98702f5

Please sign in to comment.