fix: 更新计算价的计算方式

This commit is contained in:
han0
2025-04-22 15:41:32 +08:00
parent cba5738557
commit bfb1315028

View File

@@ -190,11 +190,16 @@ class Calculator:
return getattr(self.previous_prices, 'price_recommend', 0)
def _get_calculate_price(self, round_dit=2):
prices = (self.price_ftb, self.price_ss, self.price_fhb, self.price_network, self.price_survey, self.price_last_month)
total = sum(float(i) for i in prices)
if total == 0:
prices = [
self.price_ftb * self.weight_ftb,
self.price_ss * self.weight_ss,
self.price_fhb * self.weight_fhb,
self.price_network * self.weight_network,
self.price_survey * self.weight_survey,
]
if sum(prices) == 0:
return 0
result = total / len([i for i in prices if i != 0])
result = sum(prices) / sum([self.weight_ftb, self.weight_ss, self.weight_fhb, self.weight_network, self.weight_survey])
result = round(result, round_dit)
return result