summaryrefslogtreecommitdiff
path: root/jimbrella/routine.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-02-23 20:18:30 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-02-23 20:18:30 +0800
commit12c33d56af21c6ea4cfe497425628e7e80631082 (patch)
treefc8eb147ada07246f8bb8c4908ae1cf19eb6368c /jimbrella/routine.py
parentebfad2f416f406798dce1e8fcc0c5b6058d78541 (diff)
Send return_success and remind_overdue SMS
Diffstat (limited to 'jimbrella/routine.py')
-rw-r--r--jimbrella/routine.py19
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__":