1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

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.
This commit is contained in:
Athanasius 2022-05-29 15:30:20 +01:00
parent 4a207429cd
commit 4fcd2ae3f3
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -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))