core: fix training_detail.progress display

pull/148/head
undefined 3 years ago
parent 15827eeabb
commit 3abae22545

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.26.15",
"version": "2.26.16",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",

@ -123,7 +123,7 @@ class TrainingDetailHandler extends Handler {
for (const node of tdoc.dag) {
ndict[node._id] = node;
const totalCount = node.pids.length;
const doneCount = Set.union(new Set(node.pids), donePids).size;
const doneCount = Set.intersection(new Set(node.pids), donePids).size;
const nsdoc = {
progress: totalCount ? Math.floor(100 * (doneCount / totalCount)) : 100,
isDone: training.isDone(node, doneNids, donePids),

Loading…
Cancel
Save