1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-05-29 14:49:29 +03:00

Filter commodities on legality

This commit is contained in:
Jonathan Harris 2017-09-14 18:16:55 +01:00
parent 323b414e19
commit d0cba6f4c4
2 changed files with 4 additions and 1 deletions

View File

@ -292,6 +292,8 @@ def fixup(data):
else:
if not category_map.get(commodity['categoryname'], True): # Check marketable
pass
elif commodity.get('legality'): # Check not prohibited
pass
elif not commodity.get('categoryname'):
if __debug__: print 'Missing "categoryname" for "%s"' % commodity.get('name', '')
elif not commodity.get('name'):

View File

@ -159,7 +159,8 @@ class EDDN:
def export_commodities(self, data, is_beta):
commodities = []
for commodity in data['lastStarport'].get('commodities') or []:
if category_map.get(commodity['categoryname'], True): # Check marketable
if (category_map.get(commodity['categoryname'], True) and # Check marketable
not commodity.get('legality')): # check not prohibited
commodities.append(OrderedDict([
('name', commodity['name']),
('meanPrice', int(commodity['meanPrice'])),