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

Inara: Don't send a setCommanderReputationMajorFaction if we have no Reputations

Sure the `for k, v in ...` means not sending any that are empty/none,
but it will still send the event, just with *no* reputations.

When you're on a fresh character you have no reputations yet, so avoid
causing an Inara API error, including status line text.

Close #581
This commit is contained in:
Athanasius 2021-04-06 13:17:38 +01:00
parent 960cb17cfb
commit 9fd14a3980

View File

@ -410,14 +410,16 @@ def journal_entry(
]
)
new_add_event(
'setCommanderReputationMajorFaction',
entry['timestamp'],
[
{'majorfactionName': k.lower(), 'majorfactionReputation': v / 100.0}
for k, v in state['Reputation'].items() if v is not None
]
)
# Don't send the API call with no values.
if state['Reputation']:
new_add_event(
'setCommanderReputationMajorFaction',
entry['timestamp'],
[
{'majorfactionName': k.lower(), 'majorfactionReputation': v / 100.0}
for k, v in state['Reputation'].items() if v is not None
]
)
if state['Engineers']: # Not populated < 3.3
to_send: List[Mapping[str, Any]] = []