mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add controlled rejudge (#969)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
536c697f4b
commit
466bc984bd
12 files changed
+170
-119
No files matched your search
@@ -248,18 +248,20 @@ export default class RecordModel {
|
||||
};
|
||||
if (isRejudge) upd.rejudged = true;
|
||||
const [rdocs] = await Promise.all([
|
||||
RecordModel.coll.find({ _id: { $in: rids } }).toArray(),
|
||||
RecordModel.coll.find({ _id: { $in: rids }, judgeAt: { $exists: true, $ne: null } }).toArray(),
|
||||
RecordModel.collStat.deleteMany({ _id: { $in: rids } }),
|
||||
task.deleteMany({ rid: { $in: rids } }),
|
||||
]);
|
||||
await RecordModel.collHistory.insertMany(rdocs.filter((rdoc) => rdoc.judgeAt).map((rdoc) => ({
|
||||
...pick(rdoc, [
|
||||
'compilerTexts', 'judgeTexts', 'testCases', 'subtasks',
|
||||
'score', 'time', 'memory', 'status', 'judgeAt', 'judger',
|
||||
]),
|
||||
rid: rdoc._id,
|
||||
_id: new ObjectId(),
|
||||
})));
|
||||
if (rdocs.length) {
|
||||
await RecordModel.collHistory.insertMany(rdocs.map((rdoc) => ({
|
||||
...pick(rdoc, [
|
||||
'compilerTexts', 'judgeTexts', 'testCases', 'subtasks',
|
||||
'score', 'time', 'memory', 'status', 'judgeAt', 'judger',
|
||||
]),
|
||||
rid: rdoc._id,
|
||||
_id: new ObjectId(),
|
||||
})));
|
||||
}
|
||||
return RecordModel.update(domainId, rid, upd);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user