From 4fcd2ae3f3beb2eb3c9ca53c0ebb89ffe302683c Mon Sep 17 00:00:00 2001 From: Athanasius <github@miggy.org> Date: Sun, 29 May 2022 15:30:20 +0100 Subject: [PATCH] eddn: journal: Make `SystemAddress` a check, not an augmentation On checking, all of the events valid for the journal schema (and CodexEntry has its own schema and separate EDMC code) already contain SystemAddress, so it would never be added as an augmentation. Instead, turn this into a sanity check. --- plugins/eddn.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 5335d0ac..2e219541 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -1697,6 +1697,7 @@ def journal_entry( # noqa: C901, CCR001 # The generic journal schema is for events: # Docked, FSDJump, Scan, Location, SAASignalsFound, CarrierJump # (Also CodexEntry, but that has its own schema and handling). + # Journals 2021-08-23 to 2022-05-29 # StarSystem SystemAddress StarPos # Docked Y Y N # FSDJump Y Y Y @@ -1704,7 +1705,12 @@ def journal_entry( # noqa: C901, CCR001 # Location Y Y Y # SAASignalsFound N Y N # CarrierJump Y Y Y - # add mandatory StarSystem, StarPos and SystemAddress properties to Scan events + + if 'SystemAddress' not in entry: + logger.warning("journal schema event doesn't contain SystemAddress when it should, aborting") + return "No SystemAddress in event, aborting send" + + # add mandatory StarSystem and StarPos properties to events if 'StarSystem' not in entry: if not system: logger.warning("system is falsey, can't add StarSystem") @@ -1725,13 +1731,6 @@ def journal_entry( # noqa: C901, CCR001 entry['StarPos'] = list(this.coordinates) - if 'SystemAddress' not in entry: - if not this.systemaddress: - logger.warning("this.systemaddress is falsey, can't add SystemAddress") - return "this.systemaddress is falsey, can't add SystemAddress" - - entry['SystemAddress'] = this.systemaddress - try: this.eddn.export_journal_generic(cmdr, is_beta, filter_localised(entry))