From 418753e32bcbf1975987314830827881df31560d Mon Sep 17 00:00:00 2001 From: han0 Date: Mon, 7 Apr 2025 09:22:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E4=BB=B7=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/calculators/__init__.py | 8 ++++---- web/tasks/once/calculate.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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)