fix: 修复材料半年均价显示位数异常的问题
This commit is contained in:
@@ -17,6 +17,7 @@ class Collector:
|
||||
self.year = year
|
||||
self.month = month
|
||||
self.force = True # todo-2 已发布的价格不在覆盖计算
|
||||
self.digit_map = {}
|
||||
|
||||
def get_avg(self):
|
||||
query = PricePublish.get_query(name_in=(
|
||||
@@ -110,7 +111,6 @@ class Collector:
|
||||
func.avg(PricePublish.price_zhangzhoukfq),
|
||||
PricePublish.tax,
|
||||
PricePublish.unit,
|
||||
PricePublish.display_digit
|
||||
)
|
||||
query = query.filter(PricePublish.price != 0)
|
||||
query = query.group_by(
|
||||
@@ -119,12 +119,12 @@ class Collector:
|
||||
PricePublish.spec,
|
||||
PricePublish.tax,
|
||||
PricePublish.unit,
|
||||
PricePublish.display_digit,
|
||||
)
|
||||
data = query.all()
|
||||
for item in data:
|
||||
material_id, name, spec, price, price_fuzhou, price_xiamen, price_putian, price_sanming, price_quanzhou, \
|
||||
price_zhangzhou, price_nanpin, price_longyan, price_ningde, price_pintan, price_zhangzhoukfq, tax, unit, display_digit = item
|
||||
price_zhangzhou, price_nanpin, price_longyan, price_ningde, price_pintan, price_zhangzhoukfq, tax, unit, = item
|
||||
display_digit = self.digit_map.get(material_id, 1)
|
||||
PricePublish(
|
||||
year=self.year,
|
||||
month=self.month,
|
||||
@@ -311,6 +311,7 @@ class Collector:
|
||||
'3003001',
|
||||
))
|
||||
data = query.all()
|
||||
self.digit_map = {i.material_id:i.display_digit for i in data}
|
||||
for item in data:
|
||||
PricePublish(
|
||||
year=self.year,
|
||||
|
Reference in New Issue
Block a user