diff options
author | Frederick Yin <fkfd@fkfd.me> | 2022-02-23 20:18:30 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2022-02-23 20:18:30 +0800 |
commit | 12c33d56af21c6ea4cfe497425628e7e80631082 (patch) | |
tree | fc8eb147ada07246f8bb8c4908ae1cf19eb6368c | |
parent | ebfad2f416f406798dce1e8fcc0c5b6058d78541 (diff) |
Send return_success and remind_overdue SMS
-rw-r--r-- | jimbrella/routine.py | 19 |
1 files changed, 18 insertions, 1 deletions
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__": |