dashboard(index): mastery overview numbers in X/total format
This commit is contained in:
@@ -290,11 +290,12 @@ const ov = DATA.overview;
|
|||||||
const glyph = {word:"单词", phrase:"词组", expression:"表达", grammar:"语法"};
|
const glyph = {word:"单词", phrase:"词组", expression:"表达", grammar:"语法"};
|
||||||
document.getElementById("overview").innerHTML = Object.keys(glyph).map(k => {
|
document.getElementById("overview").innerHTML = Object.keys(glyph).map(k => {
|
||||||
const o = ov[k];
|
const o = ov[k];
|
||||||
|
const T = o.total;
|
||||||
const parts = k === "grammar"
|
const parts = k === "grammar"
|
||||||
? `待修正 ${o.fix} · 已克服 ${o.known||0}`
|
? `待修正 ${o.fix}/${T} · 已克服 ${o.known||0}/${T}`
|
||||||
: `未学 ${o.new||0} · 学习中 ${o.learning} · 已掌握 ${o.known} · 待修正 ${o.fix}`;
|
: `未学 ${o.new||0}/${T} · 学习中 ${o.learning}/${T} · 已掌握 ${o.known}/${T} · 待修正 ${o.fix}/${T}`;
|
||||||
return `<div class="card"><div class="k">${glyph[k]}</div>
|
return `<div class="card"><div class="k">${glyph[k]}</div>
|
||||||
<div class="v">${o.total}</div><div class="c">${parts}</div></div>`;
|
<div class="v">${o.known||0}/${T}</div><div class="c">${parts}</div></div>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
""" + CHART_JS
|
""" + CHART_JS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user