Skip to content

Commit

Permalink
First workable version of SQLite database implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Aug 26, 2014
1 parent 42413d1 commit efcf1c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from tradedb import TradeDB, AmbiguityError
from tradecalc import Route, TradeCalc, localedNo

tdb = TradeDB('.\\TradeDangerous.sq3', debug=3)
tdb = TradeDB('.\\TradeDangerous.sq3', debug=0)

######################################################################
# Classes
Expand Down Expand Up @@ -290,7 +290,7 @@ def doChecklist(route, credits):
if args.detail:
note("HOP %d of %d" % (hopNo, lastHopIdx))

note("Buy at %s" % cur)
note("Buy at %s" % cur.str())
for (item, qty) in sorted(hop[0], key=lambda item: item[1] * item[0].gainCr, reverse=True):
itemDesc = "%s @ %dcr" % (item.item, item.costCr)
stepNo = doStep(stepNo, 'Buy %d x' % qty, itemDesc)
Expand All @@ -304,10 +304,10 @@ def doChecklist(route, credits):
for jump in jumps[idx][1:]:
stepNo = doStep(stepNo, 'Jump to', '%s' % (jump.str()))
if args.detail:
stepNo = doStep(stepNo, 'Dock at', '%s' % nxt)
stepNo = doStep(stepNo, 'Dock at', '%s' % nxt.name())
print()

note("Sell at %s" % nxt)
note("Sell at %s" % nxt.str())
for (item, qty) in sorted(hop[0], key=lambda item: item[1] * item[0].gainCr, reverse=True):
itemDesc = "%s @ %dcr" % (item.item, item.costCr + item.gainCr)
stepNo = doStep(stepNo, 'Sell %s x' % localedNo(qty), itemDesc)
Expand Down
2 changes: 1 addition & 1 deletion tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def getDestinations(self, maxJumps=None, maxLyPer=None, avoiding=None):
for node in pathList.values():
if node.distLy > epsilon: # Values indistinguishable from zero are avoidances
for station in node.system.stations:
destStations += [ Destination(node.system, station, [self] + node.via + [station], node.distLy) ]
destStations += [ Destination(node.system, station, [self.system] + node.via + [station.system], node.distLy) ]

return destStations

Expand Down

0 comments on commit efcf1c4

Please sign in to comment.