Skip to content

Commit

Permalink
Fixing problem where organic isn't shown properly
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpowell authored Oct 26, 2023
1 parent 9be0bc9 commit ea564aa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"waste": "mdi:trash-can",
"recycle": "mdi:recycle",
"organic": "mdi:leaf",
"special": "mdi:star",
}


Expand Down Expand Up @@ -114,23 +115,24 @@ def fetch(self):
entries = []

for item in data:
if "start" not in item and "start_date" not in item:
continue
key = (
"start"
if "start" in item
else "start_date"
if "start_date" in item
else ""
)
collection_date = date.fromisoformat(item[key])
if (collection_date - today).days >= 0:
entries.append(
Collection(
date=collection_date,
t=item["event_type"],
icon=ICON_MAP.get(item["event_type"]),
if "start" in item:
collection_date = date.fromisoformat(item["start"])
if (collection_date - today).days >= 0:
# Only consider recycle and waste events as they are fortnightly
if item["event_type"] in ["recycle", "waste"]:
# Every collection day includes organic
entries.append(
Collection(
date=collection_date, t="organic", icon="mdi:leaf"
)
)

entries.append(
Collection(
date=collection_date,
t=item["event_type"],
icon=ICON_MAP.get(item["event_type"]),
)
)
)

return entries
9 changes: 9 additions & 0 deletions doc/source/innerwest_nsw_gov_au.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,12 @@ waste_collection_schedule:
## How to get the source arguments
Visit the [Inner West Council (NSW)](https://www.innerwest.nsw.gov.au/live/waste-and-recycling/bins-and-clean-ups/waste-calendar) page and search for your address. The arguments should exactly match the results shown for Suburb and Street and the number portion of the Property.
## Known collection types
The following is a list of known collection types (`event_type` in the API):

- organic
- waste
- recycle
- special

0 comments on commit ea564aa

Please sign in to comment.