summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jimbrella.db.csv2
-rw-r--r--jimbrella/database.py5
-rw-r--r--jimbrella/web.py2
3 files changed, 5 insertions, 4 deletions
diff --git a/jimbrella.db.csv b/jimbrella.db.csv
index 615d8b6..a57790a 100644
--- a/jimbrella.db.csv
+++ b/jimbrella.db.csv
@@ -1,7 +1,7 @@
1,,available,,,,,
2,,lent,Jim Brella,1337,10086,,2021-10-19T09:35:30
3,,available,,,,,
-4,,lent,Big Chungus,420,10001,,1970-01-01T00:00:01
+4,,overdue,Big Chungus,420,10001,,1970-01-01T00:00:01
5,,available,,,,,
6,,available,,,,,
7,,available,,,,,
diff --git a/jimbrella/database.py b/jimbrella/database.py
index ab54a28..014b5b5 100644
--- a/jimbrella/database.py
+++ b/jimbrella/database.py
@@ -26,6 +26,7 @@ class Database:
| "withheld", "unknown")
| available : is in service on the stand
| lent : is in temporary possession of a user
+ | overdue : is in overly prolonged possession of a user
| maintenance : is on the stand but not in service
| withheld : is not on the stand but rather in the possession of an
| administrator
@@ -169,7 +170,7 @@ class Database:
umbrellas = self._read()
now = datetime.now()
for idx, umb in enumerate(umbrellas):
- if umb["status"] == "lent":
+ if umb["status"] in ("lent", "overdue"):
umbrellas[idx]["lent_at_str"] = human_datetime(umb["lent_at"])
lent_time_ago = now - umb["lent_at"]
umbrellas[idx]["lent_time_ago"] = lent_time_ago
@@ -216,7 +217,7 @@ class Database:
umb = self._find_by_serial(serial)
if umb is None:
raise ValueError(f"No umbrella with serial {serial} found.")
- elif umb["status"] != "lent":
+ elif umb["status"] not in ("lent", "overdue"):
raise ValueError(f"Umbrella with serial {serial} is not lent out.")
umb["status"] = "available"
for key in ["tenant_name", "tenant_id", "tenant_phone", "tenant_email"]:
diff --git a/jimbrella/web.py b/jimbrella/web.py
index e2de758..73b0659 100644
--- a/jimbrella/web.py
+++ b/jimbrella/web.py
@@ -16,7 +16,7 @@ def admin_index():
umbrellas=umbrellas,
available=statuses["available"],
lent=statuses["lent"],
- overdue=Database.find_overdue(statuses["lent"]),
+ overdue=statuses["overdue"],
)