fix: 更新计算价的计算方式
This commit is contained in:
@@ -190,11 +190,16 @@ class Calculator:
|
|||||||
return getattr(self.previous_prices, 'price_recommend', 0)
|
return getattr(self.previous_prices, 'price_recommend', 0)
|
||||||
|
|
||||||
def _get_calculate_price(self, round_dit=2):
|
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)
|
prices = [
|
||||||
total = sum(float(i) for i in prices)
|
self.price_ftb * self.weight_ftb,
|
||||||
if total == 0:
|
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
|
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)
|
result = round(result, round_dit)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user