mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-03 09:01:13 +03:00
EngineerProgress: Progress can be for a single engineer, no array
This tweak means we'll look in the event itself instead, but still won't cope with missing expected keys. That's up next....
This commit is contained in:
parent
a710f97c29
commit
c3b87df1b0
10
monitor.py
10
monitor.py
@ -1651,7 +1651,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
:param entry: Journal event dict
|
:param entry: Journal event dict
|
||||||
:return: True if passes validation, else False.
|
:return: True if passes validation, else False.
|
||||||
"""
|
"""
|
||||||
# The event should have at least one of thes
|
# The event should have at least one of these
|
||||||
if 'Engineers' not in entry and 'Progress' not in entry:
|
if 'Engineers' not in entry and 'Progress' not in entry:
|
||||||
logger.warning(f"EngineerProgress has neither 'Engineers' nor 'Progress': {entry=}")
|
logger.warning(f"EngineerProgress has neither 'Engineers' nor 'Progress': {entry=}")
|
||||||
return False
|
return False
|
||||||
@ -1687,7 +1687,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if 'Progress' in entry:
|
if 'Progress' in entry:
|
||||||
for e in entry['Engineers']:
|
# Progress can be only a single Engineer, so it's not an array
|
||||||
|
# { "timestamp":"2021-05-24T17:57:52Z",
|
||||||
|
# "event":"EngineerProgress",
|
||||||
|
# "Engineer":"Felicity Farseer",
|
||||||
|
# "EngineerID":300100,
|
||||||
|
# "Progress":"Invited" }
|
||||||
|
for e in entry.get('Engineers', entry):
|
||||||
for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'):
|
for f in ('Engineer', 'EngineerID', 'Rank', 'Progress', 'RankProgress'):
|
||||||
if f not in e:
|
if f not in e:
|
||||||
logger.warning(f"Engineer entry without '{f}' key: {e=} in {entry=}")
|
logger.warning(f"Engineer entry without '{f}' key: {e=} in {entry=}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user