feat: 计算逻辑更新
This commit is contained in:
@@ -24,8 +24,7 @@ class Cement325Calculator(Calculator):
|
||||
query = query.with_entities(func.avg(FuzhouTransportationBureau.price))
|
||||
data = query.first()
|
||||
price = int(data[0]) if data[0] else 0
|
||||
|
||||
fluctuating = price - int(getattr(self.previous_prices, 'ftb_price', price))
|
||||
fluctuating = int(self._get_fluctuating('price_ftb', price))
|
||||
|
||||
return price, fluctuating
|
||||
|
||||
@@ -34,8 +33,7 @@ class Cement325Calculator(Calculator):
|
||||
query = query.with_entities(func.avg(FuzhouHighwayBureau.price))
|
||||
data = query.first()
|
||||
price = int(data[0]) if data[0] else 0
|
||||
|
||||
fluctuating = price - int(getattr(self.previous_prices, 'ftb_price', price))
|
||||
fluctuating = int(self._get_fluctuating('price_fhb', price))
|
||||
|
||||
return price, fluctuating
|
||||
|
||||
@@ -43,8 +41,7 @@ class Cement325Calculator(Calculator):
|
||||
query = DataNetwork.get_query(self.year, self.month, name='水泥', spec='32.5')
|
||||
data = query.first()
|
||||
price = data.price if data else 0
|
||||
|
||||
fluctuating = price - int(getattr(self.previous_prices, 'price_network', price))
|
||||
fluctuating = int(self._get_fluctuating('price_network', price))
|
||||
|
||||
return price, fluctuating
|
||||
|
||||
@@ -53,8 +50,7 @@ class Cement325Calculator(Calculator):
|
||||
query = query.with_entities(func.avg(FujianSurvey.price))
|
||||
data = query.first()
|
||||
price = int(data[0]) if data[0] else 0
|
||||
|
||||
fluctuating = price - int(getattr(self.previous_prices, 'price_survey', price))
|
||||
fluctuating = int(self._get_fluctuating('price_survey', price))
|
||||
|
||||
return price, fluctuating
|
||||
|
||||
|
Reference in New Issue
Block a user