Commit b322d706 by 周立明

北汽结果表 环比数据显示问题修复

1 parent 38e3546a
...@@ -1992,9 +1992,14 @@ class BaicSpecialProcessor: ...@@ -1992,9 +1992,14 @@ class BaicSpecialProcessor:
_penetration(rights_total, total_delivery), _penetration(rights_total, total_delivery),
_penetration(_prev_rights, _prev_delivery))) _penetration(_prev_rights, _prev_delivery)))
else: else:
# 无上月真实任务数据 → 清空,避免残留模板示例值 # 无上月真实任务数据 → 环比默认「本月 - 0 = 本月值」(上月视为 0)
for c in range(15, 19): _cur_open_rate = _dec_to_float(summary.after_sale_scene_open_rate) if summary else None
_set_cell(ws, data_row, c, None) _set_cell(ws, data_row, 15, _diff(_cur_open_rate, 0)) # O 售后场景开通率环比 = 本月值
_set_cell(ws, data_row, 16, _diff(_visit_rate_total, 0)) # P 售前触客率环比 = 本月值
_set_cell(ws, data_row, 17, _diff( # Q 整车延保渗透率环比 = 本月值
_penetration(ext_total, total_delivery), 0))
_set_cell(ws, data_row, 18, _diff( # R 原厂权益渗透率环比 = 本月值
_penetration(rights_total, total_delivery), 0))
if cur_prev_row is not None: if cur_prev_row is not None:
lbl = ws.cell(cur_prev_row, 1).value lbl = ws.cell(cur_prev_row, 1).value
...@@ -2063,11 +2068,16 @@ class BaicSpecialProcessor: ...@@ -2063,11 +2068,16 @@ class BaicSpecialProcessor:
_diff(_penetration(rights_total, total_delivery), _diff(_penetration(rights_total, total_delivery),
_penetration(_prev_rights, _prev_delivery)) _penetration(_prev_rights, _prev_delivery))
else: else:
# 无上月真实任务 → 环比列清空(与结果表 O~R 一致) # 无上月真实任务 → 环比默认「本月 - 0 = 本月值」(与结果表 O~R 一致)
_sm_update[BaicSpecialMonthSummaryMetrics.after_sale_scene_open_rate_mom_pp] = None _cur_open_rate = _dec_to_float(summary.after_sale_scene_open_rate) if summary else None
_sm_update[BaicSpecialMonthSummaryMetrics.pre_sale_visit_rate_mom_pp] = None _sm_update[BaicSpecialMonthSummaryMetrics.after_sale_scene_open_rate_mom_pp] = \
_sm_update[BaicSpecialMonthSummaryMetrics.vehicle_ext_warranty_penetration_rate_mom_pp] = None _diff(_cur_open_rate, 0)
_sm_update[BaicSpecialMonthSummaryMetrics.original_rights_penetration_rate_mom_pp] = None _sm_update[BaicSpecialMonthSummaryMetrics.pre_sale_visit_rate_mom_pp] = \
_diff(_visit_rate_total, 0)
_sm_update[BaicSpecialMonthSummaryMetrics.vehicle_ext_warranty_penetration_rate_mom_pp] = \
_diff(_penetration(ext_total, total_delivery), 0)
_sm_update[BaicSpecialMonthSummaryMetrics.original_rights_penetration_rate_mom_pp] = \
_diff(_penetration(rights_total, total_delivery), 0)
_sm_n = BaicSpecialMonthSummaryMetrics.query.filter_by( _sm_n = BaicSpecialMonthSummaryMetrics.query.filter_by(
task_id=task.id, is_deleted=0).update(_sm_update, synchronize_session=False) task_id=task.id, is_deleted=0).update(_sm_update, synchronize_session=False)
db.session.commit() db.session.commit()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!