From af5ffabd305992628bdd2d9cc928f5324c0a89a5 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 26 May 2021 16:10:36 +0100 Subject: [PATCH] EngineerProgress: Cope with no Rank/RankProgress in 'single engineer' form Yes, this isn't DRY, if we do the check a third time I'll pull it out into a helper function. --- monitor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/monitor.py b/monitor.py index 304dc4a4..667c17e1 100644 --- a/monitor.py +++ b/monitor.py @@ -1696,6 +1696,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below for e in entry.get('Engineers', entry): for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'): if f not in e: + # For some Progress there's no Rank/RankProgress yet + if f in ('Rank', 'RankProgress'): + if (progress := e.get('Progress', None)) is not None: + if progress in ('Invited', 'Known'): + continue + logger.warning(f"Engineer entry without '{f}' key: {e=} in {entry=}") return False