fix: 修复计算异常
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from commons.models.data_fujian import DataFujian
|
||||
from commons.models.data_network import DataNetwork
|
||||
from commons.models.fujian_survey import FujianSurvey
|
||||
@@ -217,7 +219,7 @@ class Calculator:
|
||||
fluctuating = sum(self._fluctuatings) / sum([self.weight_ftb, self.weight_ss, self.weight_fhb, self.weight_network, self.weight_survey])
|
||||
fluctuating = self.round_method(fluctuating, self.round_bit)
|
||||
|
||||
price = fluctuating + previous_price
|
||||
price = Decimal(fluctuating) + Decimal(previous_price)
|
||||
price = self.round_method(price, self.round_bit)
|
||||
|
||||
return price, fluctuating
|
||||
|
@@ -39,7 +39,7 @@ if __name__ == '__main__':
|
||||
from core.factory import ClientApp
|
||||
|
||||
with ClientApp().app_context():
|
||||
calculate(2023, 3)
|
||||
calculate(2024, 4)
|
||||
|
||||
# for i in range(2, 12):
|
||||
# calculate(2022, i+1)
|
||||
|
Reference in New Issue
Block a user