core: add lang to tsdoc.journal

This commit is contained in:
undefined committed 2024-11-10 15:23:51 +08:00
1 parent b3febc63a0
commit a72175144e
2 files changed
+13 -19

No files matched your search

+11 -13
View File
@@ -849,27 +849,25 @@ export async function getStatus(domainId: string, tid: ObjectId, uid: number) {
return await document.getStatus(domainId, document.TYPE_CONTEST, tid, uid);
}
async function _updateStatus(
tdoc: Tdoc, uid: number, rid: ObjectId, pid: number, status: STATUS, score: number,
subtasks: Record<number, SubtaskResult>,
export async function updateStatus(
domainId: string, tid: ObjectId, uid: number, rid: ObjectId, pid: number,
{
status = STATUS.STATUS_WAITING,
score = 0,
subtasks,
lang,
}: { status?: STATUS, score?: number, subtasks?: Record<number, SubtaskResult>, lang?: string } = {},
) {
const tdoc = await get(domainId, tid);
if (tdoc.balloon && status === STATUS.STATUS_ACCEPTED) await addBalloon(domainId, tid, uid, rid, pid);
const tsdoc = await document.revPushStatus(tdoc.domainId, document.TYPE_CONTEST, tdoc.docId, uid, 'journal', {
rid, pid, status, score, subtasks,
rid, pid, status, score, subtasks, lang,
}, 'rid');
const journal = _getStatusJournal(tsdoc);
const stats = RULES[tdoc.rule].stat(tdoc, journal);
return await document.revSetStatus(tdoc.domainId, document.TYPE_CONTEST, tdoc.docId, uid, tsdoc.rev, { journal, ...stats });
}
export async function updateStatus(
domainId: string, tid: ObjectId, uid: number, rid: ObjectId, pid: number,
status = STATUS.STATUS_WRONG_ANSWER, score = 0, subtasks: Record<number, SubtaskResult> = {},
) {
const tdoc = await get(domainId, tid);
if (tdoc.balloon && status === STATUS.STATUS_ACCEPTED) await addBalloon(domainId, tid, uid, rid, pid);
return await _updateStatus(tdoc, uid, rid, pid, status, score, subtasks);
}
export async function getListStatus(domainId: string, uid: number, tids: ObjectId[]) {
const r = {};
// eslint-disable-next-line no-await-in-loop