fix(ui): lead with revenue comparison coverage
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
@@ -414,7 +414,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
|
||||
# ==========================================
|
||||
# 系統版本與路徑
|
||||
# ==========================================
|
||||
SYSTEM_VERSION = "V10.792"
|
||||
SYSTEM_VERSION = "V10.793"
|
||||
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
|
||||
public_url = PUBLIC_URL # 用於模板顯示
|
||||
|
||||
|
||||
@@ -1356,7 +1356,9 @@ def _load_pchome_growth_command_center(session):
|
||||
'mapping_rate': 0,
|
||||
'mapping_rate_width': 0,
|
||||
'comparison_revenue_coverage_rate': 0,
|
||||
'comparison_revenue_coverage_width': 0,
|
||||
'comparison_ready_sales_7d': 0,
|
||||
'comparison_total_sales_7d': 0,
|
||||
'needs_mapping_count': 0,
|
||||
'mapping_backlog': {
|
||||
'direct_mapping_count': 0,
|
||||
@@ -1535,6 +1537,11 @@ def _load_pchome_growth_command_center(session):
|
||||
or _to_float(stats.get('comparison_ready_sales_7d'))
|
||||
or 0
|
||||
)
|
||||
comparison_total_sales_7d = (
|
||||
_to_float(revenue_coverage.get('denominator'))
|
||||
or _to_float(stats.get('total_sales_7d'))
|
||||
or 0
|
||||
)
|
||||
action_code_counts = stats.get('action_code_counts') or {}
|
||||
candidate_count = int(stats.get('candidate_count') or 0)
|
||||
mapped_count = int(stats.get('mapped_count') or 0)
|
||||
@@ -1794,7 +1801,12 @@ def _load_pchome_growth_command_center(session):
|
||||
comparison_revenue_coverage_rate,
|
||||
1,
|
||||
),
|
||||
'comparison_revenue_coverage_width': round(
|
||||
max(0, min(100, comparison_revenue_coverage_rate)),
|
||||
1,
|
||||
),
|
||||
'comparison_ready_sales_7d': comparison_ready_sales_7d,
|
||||
'comparison_total_sales_7d': comparison_total_sales_7d,
|
||||
'needs_mapping_count': needs_mapping,
|
||||
'mapping_backlog': mapping_backlog,
|
||||
'ai_automation_readiness': ai_automation_readiness,
|
||||
|
||||
@@ -47,10 +47,10 @@
|
||||
<em>{{ growth.active_product_count | default(0) | number_format }} 個有銷售商品</em>
|
||||
</div>
|
||||
<div class="growth-command-kpi">
|
||||
<span class="growth-kpi-label">正式比價覆蓋</span>
|
||||
<strong class="growth-kpi-value momo-mono">{{ growth.mapping_rate | default(0) }}%</strong>
|
||||
<div class="growth-progress"><span style="width: {{ growth.mapping_rate_width | default(0) }}%"></span></div>
|
||||
<em>{{ growth.mapped_count | default(0) }}/{{ growth.candidate_count | default(0) }} 商品 · 業績涵蓋 {{ growth.comparison_revenue_coverage_rate | default(0) }}%</em>
|
||||
<span class="growth-kpi-label">業績比價覆蓋</span>
|
||||
<strong class="growth-kpi-value momo-mono">{{ growth.comparison_revenue_coverage_rate | default(0) }}%</strong>
|
||||
<div class="growth-progress"><span style="width: {{ growth.comparison_revenue_coverage_width | default(0) }}%"></span></div>
|
||||
<em>NT$ {{ growth.comparison_ready_sales_7d | default(0) | number_format }} / {{ growth.comparison_total_sales_7d | default(0) | number_format }} · {{ growth.mapped_count | default(0) }}/{{ growth.candidate_count | default(0) }} 商品</em>
|
||||
</div>
|
||||
<div class="growth-command-kpi">
|
||||
<span class="growth-kpi-label">最大業績分類</span>
|
||||
|
||||
@@ -318,9 +318,12 @@ def test_dashboard_exposes_count_and_revenue_coverage_without_a_text_wall():
|
||||
|
||||
template = Path("templates/dashboard_v2.html").read_text(encoding="utf-8")
|
||||
|
||||
assert "正式比價覆蓋" in template
|
||||
assert "業績涵蓋" in template
|
||||
assert "growth.comparison_revenue_coverage_rate" in template
|
||||
assert "業績比價覆蓋" in template
|
||||
assert "growth.comparison_revenue_coverage_rate | default(0)" in template
|
||||
assert "growth.comparison_revenue_coverage_width | default(0)" in template
|
||||
assert "growth.comparison_ready_sales_7d" in template
|
||||
assert "growth.comparison_total_sales_7d" in template
|
||||
assert "growth.mapped_count" in template
|
||||
|
||||
|
||||
def test_same_item_reconciliation_route_returns_durable_readback(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user