From 654f038465f286de94aa1a3974f8389438a58e5a Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Fri, 29 Oct 2021 15:09:26 +0800 Subject: Fix description format tokens in AdminLog.read() --- jimbrella/admin_log.py | 23 +++++++++-------------- 1 file 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],,,,,,[note] + TAKEAWAY,[date],,,,,,[note] A user borrows an umbrella normally. - GIVEBACK,[date],,,,,,[note] + GIVEBACK,[date],,,,,,[note] A user returns an umbrella normally. - OVERDUE,[date],,,,,,[note] + OVERDUE,[date],,,,,,[note] An umbrella is judged overdue by JImbrella's routine process. - ADMIN_MODIFY_DB,[date],[admin_name],,[column],[past_value],[new_value],[note] + ADMIN_MODIFY_DB,[date],[admin_name],,[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}." -- cgit v1.2.3