diff --git a/tradedb.py b/tradedb.py index d2368348..18505aea 100644 --- a/tradedb.py +++ b/tradedb.py @@ -35,21 +35,23 @@ class Station(object): def __init__(self, ID, system, station): self.ID, self.system, self.station = ID, system.replace(' ', ''), station.replace(' ', '') self.links = {} - self.stations = [] + self.stations = {} def addTrade(self, dest, item, itemID, costCr, gainCr): """ Add a Trade entry from this to a destination station """ dstID = dest.ID if not dstID in self.links: self.links[dstID] = [] - self.stations.append(dest) + self.stations[dest] = None trade = Trade(item, itemID, costCr, gainCr) self.links[dstID].append(trade) def organizeTrades(self): - for station in self.links: - items = self.links[station] + for dstID in self.links: + items = self.links[dstID] items.sort(key=lambda trade: trade.gainCr, reverse=True) + for dest in self.stations: + self.stations[dest] = self.links[dest.ID] def __str__(self): str = self.system + " " + self.station