mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
markdown语法增强,错误修复
This commit is contained in:
1 parent
4b3c10b4eb
commit
a29b801e72
22 files changed
+311
-200
No files matched your search
@@ -3,21 +3,34 @@ const domain = require('../model/domain');
|
||||
const contest = require('../model/contest');
|
||||
const user = require('../model/user');
|
||||
const rating = require('../lib/rating');
|
||||
const { STATUS } = require('../model/builtin');
|
||||
|
||||
async function run({ domainId, isSub = false }, report) {
|
||||
if (!domainId) {
|
||||
const domains = await domain.getMulti().toArray();
|
||||
await report({ total: domains.length });
|
||||
await report({ message: `Found ${domains.length} domains` });
|
||||
for (const i in domains) {
|
||||
const start = new Date().getTime();
|
||||
await run({ domainId: domains[i]._id, isSub: true }, report);
|
||||
await report({ current: parseInt(i) + 1 });
|
||||
await report({
|
||||
case: {
|
||||
status: STATUS.STATUS_ACCEPTED,
|
||||
judgeText: `Domain ${i} finished`,
|
||||
time_ms: new Date().getTime() - start,
|
||||
memory_kb: 0,
|
||||
score: 0,
|
||||
},
|
||||
progress: Math.floor(((parseInt(i) + 1) / domains.length) * 100),
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
await user.setMultiInDomain(domainId, {}, { rating: 1500 });
|
||||
const contests = await contest.getMulti(domainId, { rated: true }).sort('endAt', -1).toArray();
|
||||
await report({ total: contests.length });
|
||||
await report({ message: `Found ${contests.length} contests in ${domainId}` });
|
||||
const udict = {};
|
||||
for (const i in contests) {
|
||||
const start = new Date().getTime();
|
||||
const tdoc = contests[i];
|
||||
const tsdocs = await contest.getMultiStatus(domainId, { docId: tdoc.docId })
|
||||
.sort(contest.RULES[tdoc.rule].statusSort).toArray();
|
||||
@@ -30,8 +43,18 @@ async function run({ domainId, isSub = false }, report) {
|
||||
for (const udoc of rated) {
|
||||
udict[udoc.uid] = udoc.new;
|
||||
}
|
||||
if (isSub) await report({ subProgress: (i + 1) / contests.length });
|
||||
else await report({ current: parseInt(i) + 1 });
|
||||
if (!isSub) {
|
||||
await report({ progress: Math.floor(((parseInt(i) + 1) / contests.length) * 100) });
|
||||
}
|
||||
await report({
|
||||
case: {
|
||||
status: STATUS.STATUS_ACCEPTED,
|
||||
judgeText: `Contest ${tdoc.title} finished`,
|
||||
time_ms: new Date().getTime() - start,
|
||||
memory_kb: 0,
|
||||
score: 0,
|
||||
},
|
||||
});
|
||||
}
|
||||
const tasks = [];
|
||||
for (const uid in udict) {
|
||||
|
||||
Reference in new issue
Block a user