summaryrefslogtreecommitdiff
path: root/jimbrella/routine.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2021-11-23 16:37:18 +0800
committerFrederick Yin <fkfd@fkfd.me>2021-11-23 16:37:18 +0800
commit27293255bfaa418cd6e6031f77493a78a10a18bc (patch)
tree95d8aaf9f862400888a5548a4df40d7693fb3283 /jimbrella/routine.py
parent71d7499649a38d11fa3997facab64886a2abe92e (diff)
Keep track of overdue umbrellas
Also keep an admin log entry
Diffstat (limited to 'jimbrella/routine.py')
-rw-r--r--jimbrella/routine.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/jimbrella/routine.py b/jimbrella/routine.py
index a4ad638..33c48dc 100644
--- a/jimbrella/routine.py
+++ b/jimbrella/routine.py
@@ -112,7 +112,7 @@ def sync_database(takeaway: JForm, giveback: JForm, db: Database, admin: AdminLo
)
-def process_overdue(db: Database):
+def process_overdue(db: Database, admin: AdminLog):
overdue = Database.find_overdue(db.read())
# mark and log umbrellas that were not, but just became overdue
for umb in filter(lambda u: u["status"] == "lent", overdue):
@@ -124,6 +124,16 @@ def process_overdue(db: Database):
umb["tenant_id"],
umb["tenant_phone"],
)
+ admin.log(
+ "OVERDUE",
+ {
+ "key": umb["serial"],
+ "name": umb["tenant_name"],
+ "phone": umb["tenant_phone"],
+ "id": umb["tenant_id"],
+ "email": "",
+ },
+ )
if __name__ == "__main__":
@@ -132,3 +142,4 @@ if __name__ == "__main__":
db = Database(DATABASE_PATH)
admin_log = AdminLog(ADMIN_LOG_PATH)
sync_database(takeaway, giveback, db, admin_log)
+ process_overdue(db, admin_log)