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

Merge pull request #587 from EDCD/fix/586-EDDB-system-links

Fix/586 eddb system links
This commit is contained in:
Athanasius 2020-07-11 19:48:19 +01:00 committed by GitHub
commit 96f7457ae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,10 +69,17 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
def cmdr_data(data, is_beta):
if config.get('system_provider') == 'eddb':
this.system_address = data['lastSystem']['id'] or this.system_address
this.system_link['url'] = system_url(this.system_address) # Override standard URL function
# Only fill in system_address from CAPI if it's not set yet
# This is to avoid CAPI lagging causing incorrect value
if not this.system_address:
this.system_address = data['lastSystem']['id']
this.system_link['url'] = system_url(this.system_address) # Override standard URL function
if config.get('station_provider') == 'eddb':
this.station_marketid = data['commander']['docked'] and data['lastStarport']['id']
this.station_link['text'] = data['commander']['docked'] and data['lastStarport']['name'] or (data['lastStarport']['name'] and data['lastStarport']['name'] != "" and STATION_UNDOCKED or '')
this.station_link.update_idletasks()
# 'eddb' is also the *default* Station provider
if not config.get('station_provider') or config.get('station_provider') == 'eddb':
# Only use CAPI value if not yet set
# This is to avoid CAPI lagging causing incorrect value
if not this.station_marketid:
this.station_marketid = data['commander']['docked'] and data['lastStarport']['id']
this.station_link['text'] = data['commander']['docked'] and data['lastStarport']['name'] or (data['lastStarport']['name'] and data['lastStarport']['name'] != "" and STATION_UNDOCKED or '')
this.station_link.update_idletasks()