summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jimbrella/database.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/jimbrella/database.py b/jimbrella/database.py
index f0d519e..f069229 100644
--- a/jimbrella/database.py
+++ b/jimbrella/database.py
@@ -23,7 +23,7 @@ class Database:
- serial | (id) unique identifier for the umbrella.
- alias | (string) future compatibility. a human readable (preferably cute) name
| for a particular umbrella
- - status | (string) one of ("available", "lent", "withheld", "maintenance",
+ - status | (string) one of ("available", "lent", "overdue", "maintenance",
| "withheld", "unknown")
| available : is in service on the stand
| lent : is in temporary possession of a user
@@ -181,7 +181,10 @@ class Database:
def group_by_status(umbrellas) -> dict:
"""(static method) Returns umbrellas grouped into a dict by their status."""
keys = set([umb["status"] for umb in umbrellas])
- statuses = {}
+ # initiate statuses: each status is []
+ statuses = dict.fromkeys(
+ ["available", "lent", "overdue", "withheld", "maintenance", "unknown"], []
+ )
for key in keys:
statuses[key] = [umb for umb in umbrellas if umb["status"] == key]
return statuses