params['sellingShipIdsString'] = ','.join([str(s['id']) for s in ships])
return params
- def format_station(self, station, reference_coords = None):
+ def format_station(self, station, params, reference_coords = None):
text = ''
+ market_updated = station['market_updated_at']
+ shipyard_updated = station['shipyard_updated_at']
+ updated = shipyard_updated
+ if shipyard_updated is None or 'sellsCommodityIds' in params:
+ if market_updated is None:
+ updated = shipyard_updated
+ else:
+ updated = market_updated
+ if shipyard_updated is not None:
+ if 'sellingModulesIdsString' in params or 'sellingShipIdsString' in params:
+ updated = min(market_updated, shipyard_updated)
+
system = station['system']
if reference_coords is not None:
text += '{}Ls from *{}* star'.format(station['distance_to_star'], system['name'])
else:
text += 'in *{}*'.format(system['name'])
+ if updated is not None:
+ text += ' updated {}'.format(bot.ago(updated))
return text
@asyncio.coroutine
log.info(params)
lines = []
for station in eddb.find_station(params, 'system'):
- lines.append(self.format_station(station, reference_coords))
+ lines.append(self.format_station(station, params, reference_coords))
if not len(lines):
lines = ['*shrugs*']
if not message.channel.is_private: