diff options
Diffstat (limited to 'jimbrella/database.py')
-rw-r--r-- | jimbrella/database.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/jimbrella/database.py b/jimbrella/database.py index 7f10c55..ab54a28 100644 --- a/jimbrella/database.py +++ b/jimbrella/database.py @@ -1,7 +1,7 @@ import csv import os from datetime import datetime, timedelta -from .utils import human_timedelta +from .utils import human_datetime, human_timedelta from .config import DUE_HOURS @@ -161,14 +161,16 @@ class Database: All exposed methods with a return value should use this method instead of `_read()`. Supplemental data: + - lent_at_str: string representation for lent_at. - lent_time_ago: time since umbrella was taken away by tenant. if umbrella is not taken away, its value is None. - - lent_time_ago_str: lent_time_ago as a string representation. + - lent_time_ago_str: string representation for lent_time_ago. """ umbrellas = self._read() now = datetime.now() for idx, umb in enumerate(umbrellas): if umb["status"] == "lent": + 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 umbrellas[idx]["lent_time_ago_str"] = human_timedelta(lent_time_ago) |