diff options
Diffstat (limited to 'jimbrella')
-rw-r--r-- | jimbrella/admin_log.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/jimbrella/admin_log.py b/jimbrella/admin_log.py index 4cc9b16..aea1a27 100644 --- a/jimbrella/admin_log.py +++ b/jimbrella/admin_log.py @@ -9,7 +9,8 @@ class AdminLog: The file is intended to be read, deserialized, and represented in a user-friendly format to an admin on the web console. The file format is csv, but the number and meanings of columns may - not be uniform for all rows. + not be uniform for all rows. This is why it cannot be a subclass of CsvTable, which expects the + columns to be uniform. For each row, there are a minimum of three columns. The first column is called the "event". It describes the log entry by and large. What other columns in the row represent depends on @@ -96,19 +97,25 @@ class AdminLog: info = [] if event in ("TAKEAWAY", "GIVEBACK", "OVERDUE"): info = [ - entry["serial"], - entry["tenant_name"], - entry["tenant_id"], - entry["tenant_phone"], - entry["tenant_email"], + entry[col] + for col in [ + "serial", + "tenant_name", + "tenant_id", + "tenant_phone", + "tenant_email", + ] ] elif event == "ADMIN_MODIFY_DB": info = [ - entry["admin_name"], - entry["serial"], - entry["column"], - entry["past_value"], - entry["new_value"], + entry[col] + for col in [ + "admin_name", + "serial", + "column", + "past_value", + "new_value", + ] ] line.extend(info) |