mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
修复一些错误
This commit is contained in:
1 parent
bc50913e6e
commit
2b6a510c1e
23 files changed
+321
-191
No files matched your search
+14
-3
@@ -26,7 +26,19 @@ async function add(domainId, data) {
|
||||
judger: null,
|
||||
judgeAt: null,
|
||||
});
|
||||
const res = await coll.insertOne(data);
|
||||
const [pdoc, res] = await Promise.all([
|
||||
problem.get(domainId, data.pid),
|
||||
coll.insertOne(data),
|
||||
]);
|
||||
await task.add({
|
||||
type: 'judge',
|
||||
rid: res.insertedId,
|
||||
domainId,
|
||||
pid: data.pid,
|
||||
data: pdoc.data,
|
||||
lang: data.lang,
|
||||
code: data.code,
|
||||
});
|
||||
return res.insertedId;
|
||||
}
|
||||
|
||||
@@ -35,11 +47,10 @@ async function add(domainId, data) {
|
||||
* @param {ObjectID} rid
|
||||
* @returns {import('../interface').Record}
|
||||
*/
|
||||
async function get(domainId, rid, showHidden = false) {
|
||||
async function get(domainId, rid) {
|
||||
const _id = new ObjectID(rid);
|
||||
const rdoc = await coll.findOne({ domainId, _id });
|
||||
if (!rdoc) throw new RecordNotFoundError(rid);
|
||||
if (rdoc.hidden && !showHidden) throw new PermissionError(rid);
|
||||
return rdoc;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user