fix: 修复推荐价计算错误的问题
This commit is contained in:
@@ -152,8 +152,8 @@ class Calculator:
|
||||
def _get_ss_price(self):
|
||||
query = SanmingSteel.get_query(self.year, self.month, material=self.material_id)
|
||||
data = query.first()
|
||||
price = int(data.price) if data else 0
|
||||
fluctuating = int(self._get_fluctuating('price_ss', price))
|
||||
price = data.price if data else 0
|
||||
fluctuating = self._get_fluctuating('price_ss', price)
|
||||
return price, fluctuating
|
||||
|
||||
def _get_fhb_price(self):
|
||||
@@ -202,9 +202,9 @@ class Calculator:
|
||||
if not self.previous_prices:
|
||||
return 0, 0
|
||||
|
||||
previous_price = int(getattr(self.previous_prices, 'price_recommend', 0))
|
||||
previous_price = float(getattr(self.previous_prices, 'price_recommend', 0))
|
||||
if not previous_price:
|
||||
previous_price = int(getattr(self.previous_prices, 'price_calculate', 0))
|
||||
previous_price = float(getattr(self.previous_prices, 'price_calculate', 0))
|
||||
|
||||
self._fluctuatings = [
|
||||
self.fluctuating_ftb * self.weight_ftb,
|
||||
|
@@ -39,7 +39,7 @@ if __name__ == '__main__':
|
||||
from core.factory import ClientApp
|
||||
|
||||
with ClientApp().app_context():
|
||||
calculate(2024, 7)
|
||||
calculate(2023, 3)
|
||||
|
||||
# for i in range(2, 12):
|
||||
# calculate(2022, i+1)
|
||||
|
Reference in New Issue
Block a user