Skip to content

Commit

Permalink
Don't return None as a price, always return a float (#1291) (#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzmann authored Sep 22, 2017
1 parent f37f457 commit 73d9dd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions eos/db/saveddata/price.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

prices_table = Table("prices", saveddata_meta,
Column("typeID", Integer, primary_key=True),
Column("price", Float),
Column("price", Float, default=0.0),
Column("time", Integer, nullable=False),
Column("failed", Integer))

mapper(Price, prices_table)
mapper(Price, prices_table, properties={
"_Price__price": prices_table.c.price,
})
10 changes: 9 additions & 1 deletion eos/saveddata/price.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Price(object):
def __init__(self, typeID):
self.typeID = typeID
self.time = 0
self.price = 0
self.__price = 0
self.failed = None

@reconstructor
Expand All @@ -40,3 +40,11 @@ def init(self):
@property
def isValid(self):
return self.time >= time.time()

@property
def price(self):
return self.__price or 0.0

@price.setter
def price(self, price):
self.__price = price

0 comments on commit 73d9dd6

Please sign in to comment.