1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

No longer collate average commodity prices

This commit is contained in:
Jonathan Harris 2017-09-13 15:40:41 +01:00
parent 302ce0b637
commit e438ba216a
2 changed files with 2 additions and 5 deletions

View File

@ -165,7 +165,7 @@ try:
else:
print data['lastSystem']['name']
if (args.m or args.o or args.s or args.n):
if (args.m or args.o or args.s or args.n or args.j):
if not data['commander'].get('docked'):
sys.stderr.write("You're not docked at a station!\n")
sys.exit(EXIT_SUCCESS)

View File

@ -36,14 +36,11 @@ def addcommodities(data):
new = {
'id' : commodity['id'],
'category' : commodity['categoryname'],
'average' : commodity['cost_mean'].split('.')[0]
}
old = commodities.get(key)
if old:
if new['id'] != old['id'] or new['category'] != old['category']:
raise AssertionError('%s: "%s"!="%s"' % (key, new, old))
elif new['average'] != old['average']:
size_pre -= 1
commodities[key] = new
if len(commodities) > size_pre:
@ -54,7 +51,7 @@ def addcommodities(data):
os.rename(commodityfile, commodityfile+'.bak')
with open(commodityfile, 'wb') as csvfile:
writer = csv.DictWriter(csvfile, ['id','category', 'name', 'average'])
writer = csv.DictWriter(csvfile, ['id','category', 'name'])
writer.writeheader()
for key in commodities:
commodities[key]['name'] = key