From 9b54675cdb49ea3123d75b8329a6f0e2ded4402f Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Tue, 9 Aug 2016 17:20:16 +0100 Subject: [PATCH] Round sell and buy prices down to integer Fixes #135 --- commodity.py | 4 ++-- eddn.py | 4 ++-- td.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commodity.py b/commodity.py index 7967322b..89d8ca64 100644 --- a/commodity.py +++ b/commodity.py @@ -45,8 +45,8 @@ def export(data, kind=COMMODITY_DEFAULT, filename=None): line = sep.join([ rowheader, commodity['name'], - commodity['sellPrice'] and str(commodity['sellPrice']) or '', - commodity['buyPrice'] and str(commodity['buyPrice']) or '', + commodity['sellPrice'] and str(int(commodity['sellPrice'])) or '', + commodity['buyPrice'] and str(int(commodity['buyPrice'])) or '', str(int(commodity['demand'])) if commodity['demandBracket'] else '', bracketmap[commodity['demandBracket']], str(int(commodity['stock'])) if commodity['stockBracket'] else '', diff --git a/eddn.py b/eddn.py index f430cdc5..d70864ba 100644 --- a/eddn.py +++ b/eddn.py @@ -52,9 +52,9 @@ def export_commodities(data): for commodity in data['lastStarport'].get('commodities', []): commodities.append({ 'name' : commodity['name'], - 'buyPrice' : commodity['buyPrice'], + 'buyPrice' : int(commodity['buyPrice']), 'supply' : int(commodity['stock']), - 'sellPrice' : commodity['sellPrice'], + 'sellPrice' : int(commodity['sellPrice']), 'demand' : int(commodity['demand']), }) if commodity['stockBracket']: diff --git a/td.py b/td.py index 5bf6fec6..0c3ff3dc 100644 --- a/td.py +++ b/td.py @@ -43,8 +43,8 @@ def export(data): for commodity in sorted(bycategory[category], key=itemgetter('name')): h.write(' %-23s %7d %7d %9s%c %8s%c %s\n' % ( commodity['name'], - commodity['sellPrice'], - commodity['buyPrice'], + int(commodity['sellPrice']), + int(commodity['buyPrice']), int(commodity['demand']) if commodity['demandBracket'] else '', demandbracketmap[commodity['demandBracket']], int(commodity['stock']) if commodity['stockBracket'] else '',