mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-15 00:30:33 +03:00
No longer collate average commodity prices
This commit is contained in:
parent
302ce0b637
commit
e438ba216a
2
EDMC.py
2
EDMC.py
@ -165,7 +165,7 @@ try:
|
|||||||
else:
|
else:
|
||||||
print data['lastSystem']['name']
|
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'):
|
if not data['commander'].get('docked'):
|
||||||
sys.stderr.write("You're not docked at a station!\n")
|
sys.stderr.write("You're not docked at a station!\n")
|
||||||
sys.exit(EXIT_SUCCESS)
|
sys.exit(EXIT_SUCCESS)
|
||||||
|
@ -36,14 +36,11 @@ def addcommodities(data):
|
|||||||
new = {
|
new = {
|
||||||
'id' : commodity['id'],
|
'id' : commodity['id'],
|
||||||
'category' : commodity['categoryname'],
|
'category' : commodity['categoryname'],
|
||||||
'average' : commodity['cost_mean'].split('.')[0]
|
|
||||||
}
|
}
|
||||||
old = commodities.get(key)
|
old = commodities.get(key)
|
||||||
if old:
|
if old:
|
||||||
if new['id'] != old['id'] or new['category'] != old['category']:
|
if new['id'] != old['id'] or new['category'] != old['category']:
|
||||||
raise AssertionError('%s: "%s"!="%s"' % (key, new, old))
|
raise AssertionError('%s: "%s"!="%s"' % (key, new, old))
|
||||||
elif new['average'] != old['average']:
|
|
||||||
size_pre -= 1
|
|
||||||
commodities[key] = new
|
commodities[key] = new
|
||||||
|
|
||||||
if len(commodities) > size_pre:
|
if len(commodities) > size_pre:
|
||||||
@ -54,7 +51,7 @@ def addcommodities(data):
|
|||||||
os.rename(commodityfile, commodityfile+'.bak')
|
os.rename(commodityfile, commodityfile+'.bak')
|
||||||
|
|
||||||
with open(commodityfile, 'wb') as csvfile:
|
with open(commodityfile, 'wb') as csvfile:
|
||||||
writer = csv.DictWriter(csvfile, ['id','category', 'name', 'average'])
|
writer = csv.DictWriter(csvfile, ['id','category', 'name'])
|
||||||
writer.writeheader()
|
writer.writeheader()
|
||||||
for key in commodities:
|
for key in commodities:
|
||||||
commodities[key]['name'] = key
|
commodities[key]['name'] = key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user