mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
remove ensureindex api (use postInit instead)
This commit is contained in:
1 parent
be9d2bffb9
commit
e62e7b49a3
13 files changed
+56
-107
No files matched your search
+3
-17
@@ -80,31 +80,17 @@ export async function add(
|
||||
rejudged: false,
|
||||
};
|
||||
if ((contestOrConfig as ContestInfo).type) {
|
||||
// is contest
|
||||
data.contest = contestOrConfig as ContestInfo;
|
||||
} else {
|
||||
data.config = contestOrConfig as PretestConfig;
|
||||
}
|
||||
const [pdoc, res] = await Promise.all([
|
||||
problem.get(domainId, pid, null),
|
||||
coll.insertOne(data),
|
||||
]);
|
||||
const res = await coll.insertOne(data);
|
||||
if (addTask) {
|
||||
const t: any = {
|
||||
await task.add({
|
||||
type: 'judge',
|
||||
rid: res.insertedId,
|
||||
domainId,
|
||||
pid: data.pid,
|
||||
lang: data.lang,
|
||||
code: data.code,
|
||||
};
|
||||
if (t.type === 'judge') {
|
||||
t.data = pdoc.data;
|
||||
t.config = pdoc.config;
|
||||
} else {
|
||||
t.config = yaml.safeDump(contestOrConfig);
|
||||
}
|
||||
await task.add(t);
|
||||
});
|
||||
}
|
||||
return res.insertedId;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user