summaryrefslogtreecommitdiff
path: root/jimbrella/admin_log.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2021-10-29 15:09:26 +0800
committerFrederick Yin <fkfd@fkfd.me>2021-10-29 15:09:26 +0800
commit654f038465f286de94aa1a3974f8389438a58e5a (patch)
treed4f11f4b4d06beb216499ef504d8350afbb87258 /jimbrella/admin_log.py
parentf56dfc7e850ad4b4c33f35b24a712d7f92a23454 (diff)
Fix description format tokens in AdminLog.read()
Diffstat (limited to 'jimbrella/admin_log.py')
-rw-r--r--jimbrella/admin_log.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/jimbrella/admin_log.py b/jimbrella/admin_log.py
index 1b3ce1e..8308336 100644
--- a/jimbrella/admin_log.py
+++ b/jimbrella/admin_log.py
@@ -19,16 +19,16 @@ class AdminLog:
is called the "note", an optional textual note in natural language.
Here we list possible events, what information will follow them, and the scenario for each one.
- Words surrounded by angle brackets (< >) are defined in class Database, and those in square
+ Words surrounded by angle brackets (< >) are defined in JForm.get_unread, and those in square
brackets ([ ]) are defined here in AdminLog.
- TAKEAWAY,[date],<serial>,<tenant_name>,<tenant_id>,<tenant_phone>,<tenant_email>,[note]
+ TAKEAWAY,[date],<key>,<name>,<id>,<phone>,<email>,[note]
A user borrows an umbrella normally.
- GIVEBACK,[date],<serial>,<tenant_name>,<tenant_id>,<tenant_phone>,<tenant_email>,[note]
+ GIVEBACK,[date],<key>,<name>,<id>,<phone>,<email>,[note]
A user returns an umbrella normally.
- OVERDUE,[date],<serial>,<tenant_name>,<tenant_id>,<tenant_phone>,<tenant_email>,[note]
+ OVERDUE,[date],<key>,<name>,<id>,<phone>,<email>,[note]
An umbrella is judged overdue by JImbrella's routine process.
- ADMIN_MODIFY_DB,[date],[admin_name],<serial>,[column],[past_value],[new_value],[note]
+ ADMIN_MODIFY_DB,[date],[admin_name],<key>,[column],[past_value],[new_value],[note]
An admin makes modifications to one cell of the database via the web console or API.
If multiple cells are modified, the same number of log entries are written, although
they can be multiplexed in one HTTP request.
@@ -87,19 +87,14 @@ class AdminLog:
friendly_logs = []
for entry in logs:
event = entry["event"]
- tenant_info = "(ID: {tenant_id}, phone: {tenant_phone})"
+ tenant_info = "(ID: {id}, phone: {phone})"
if event == "TAKEAWAY":
- description = (
- "{tenant_name} borrowed umbrella #{serial}. " + tenant_info
- )
+ description = "{name} borrowed umbrella #{key}. " + tenant_info
elif event == "GIVEBACK":
- description = (
- "{tenant_name} returned umbrella #{serial}. " + tenant_info
- )
+ description = "{name} returned umbrella #{key}. " + tenant_info
elif event == "OVERDUE":
description = (
- "{tenant_name} missed the due for umbrella #{serial}. "
- + tenant_info
+ "{name} missed the due for umbrella #{key}. " + tenant_info
)
elif event == "ADMIN_MODIFY_DB":
description = "{admin_name} changed {column} of umbrella #{serial} from {past_value} to {new_value}."