Add dashboard completion metric
This commit is contained in:
@@ -7,3 +7,4 @@ outputs/
|
|||||||
备份/
|
备份/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
*.zip
|
||||||
|
|||||||
@@ -370,6 +370,11 @@ def make_records() -> dict[str, Any]:
|
|||||||
item["rank"] = i
|
item["rank"] = i
|
||||||
no_score = [c for c in commodities if c["total"] is None]
|
no_score = [c for c in commodities if c["total"] is None]
|
||||||
commodities = ranked + no_score
|
commodities = ranked + no_score
|
||||||
|
completion_total = len(commodities)
|
||||||
|
completion_count = sum(
|
||||||
|
all(c["dims"].get(dim, {}).get("years") for dim in DIMENSIONS)
|
||||||
|
for c in commodities
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
"generated_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
"generated_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
"source_files": {
|
"source_files": {
|
||||||
@@ -379,6 +384,11 @@ def make_records() -> dict[str, Any]:
|
|||||||
},
|
},
|
||||||
"dimensions": DIMENSIONS + ["月差"],
|
"dimensions": DIMENSIONS + ["月差"],
|
||||||
"boards": sorted(set(board for c in commodities for board in c.get("boards", [c["board"]]))),
|
"boards": sorted(set(board for c in commodities for board in c.get("boards", [c["board"]]))),
|
||||||
|
"completion": {
|
||||||
|
"count": completion_count,
|
||||||
|
"total": completion_total,
|
||||||
|
"ratio": round(100.0 * completion_count / completion_total, 1) if completion_total else 0,
|
||||||
|
},
|
||||||
"commodities": commodities,
|
"commodities": commodities,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +498,7 @@ svg {{ width:100%; height:230px; display:block; }}
|
|||||||
<button class="tabbtn" id="historyTab">评分走势</button>
|
<button class="tabbtn" id="historyTab">评分走势</button>
|
||||||
<button id="refreshData">刷新数据</button>
|
<button id="refreshData">刷新数据</button>
|
||||||
<button id="reset">重置</button>
|
<button id="reset">重置</button>
|
||||||
<div class="stamp">核心修正:库存反向计分 生成时间:<span id="generated"></span></div>
|
<div class="stamp">完成度:<span id="completion"></span> 核心修正:库存反向计分 生成时间:<span id="generated"></span></div>
|
||||||
</div>
|
</div>
|
||||||
<section class="summary">
|
<section class="summary">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -551,6 +561,7 @@ const refreshData = document.getElementById("refreshData");
|
|||||||
for (const d of dims) dimSel.append(new Option(d, d));
|
for (const d of dims) dimSel.append(new Option(d, d));
|
||||||
for (const b of DATA.boards) boardSel.append(new Option(b, b));
|
for (const b of DATA.boards) boardSel.append(new Option(b, b));
|
||||||
document.getElementById("generated").textContent = DATA.generated_at;
|
document.getElementById("generated").textContent = DATA.generated_at;
|
||||||
|
document.getElementById("completion").textContent = `${{DATA.completion.count}}/${{DATA.completion.total}}(${{DATA.completion.ratio.toFixed(1)}}%)`;
|
||||||
function todayString() {{
|
function todayString() {{
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
return `${{d.getFullYear()}}-${{String(d.getMonth()+1).padStart(2,"0")}}-${{String(d.getDate()).padStart(2,"0")}}`;
|
return `${{d.getFullYear()}}-${{String(d.getMonth()+1).padStart(2,"0")}}-${{String(d.getDate()).padStart(2,"0")}}`;
|
||||||
|
|||||||
+3
-2
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user