fix: 修复推荐价计算错误的问题

This commit is contained in:
han0
2025-04-07 09:22:50 +08:00
parent d6389510ae
commit 418753e32b
2 changed files with 5 additions and 5 deletions

View File

@@ -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,

View File

@@ -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)