diff --git a/web/calculators/__init__.py b/web/calculators/__init__.py index c49d8d4..55040fd 100644 --- a/web/calculators/__init__.py +++ b/web/calculators/__init__.py @@ -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, diff --git a/web/tasks/once/calculate.py b/web/tasks/once/calculate.py index 17199f3..2cc972c 100644 --- a/web/tasks/once/calculate.py +++ b/web/tasks/once/calculate.py @@ -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)