From 12c33d56af21c6ea4cfe497425628e7e80631082 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Wed, 23 Feb 2022 20:18:30 +0800 Subject: Send return_success and remind_overdue SMS --- jimbrella/routine.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'jimbrella/routine.py') diff --git a/jimbrella/routine.py b/jimbrella/routine.py index 3d92482..bb5fe82 100644 --- a/jimbrella/routine.py +++ b/jimbrella/routine.py @@ -63,7 +63,12 @@ def sync_jform(takeaway: JForm, giveback: JForm, db: Umbrellas, sms: SMS): sheet["id"], sheet["phone"], ) - sms.borrow_success(sheet["phone"], sheet["name"], human_datetime(sheet["date"]), sheet["key"]) + sms.borrow_success( + sheet["phone"], + sheet["name"], + human_datetime(sheet["date"]), + sheet["key"], + ) except (UmbrellaStatusError, UmbrellaNotFoundError): logging.warning( tenant_identity @@ -78,6 +83,12 @@ def sync_jform(takeaway: JForm, giveback: JForm, db: Umbrellas, sms: SMS): tenant_identity + " returned umbrella #{key} at {date_str}".format(**sheet) ) + sms.return_success( + sheet["phone"], + sheet["name"], + human_datetime(sheet["date"]), + sheet["key"], + ) except (UmbrellaStatusError, UmbrellaNotFoundError): logging.warning( tenant_identity @@ -115,6 +126,12 @@ def process_overdue(db: Umbrellas): **umb ) ) + sms.remind_overdue( + umb["tenant_phone"], + umb["tenant_name"], + human_datetime(umb["lent_at"]), + umb["id"], + ) if __name__ == "__main__": -- cgit v1.2.3