core: 修复跨域引题目时订题显示异常

This commit is contained in:
undefined committed 2021-08-27 22:14:05 +08:00
1 parent 80f34547da
commit 1e0d6d9148
2 files changed
+8 -5

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.33.12", "version": "2.33.13",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+7 -4
View File
@@ -219,7 +219,7 @@ const oi: ContestRule = {
); );
for (const tpsdoc of psdocs) { for (const tpsdoc of psdocs) {
for (const psdoc of tpsdoc) { for (const psdoc of tpsdoc) {
psdict[`${psdoc.uid}/${psdoc.docId}`] = psdoc; psdict[`${psdoc.uid}/${psdoc.domainId}/${psdoc.docId}`] = psdoc;
} }
} }
} }
@@ -236,8 +236,11 @@ const oi: ContestRule = {
{ type: 'string', value: tsdoc.score || 0 }, { type: 'string', value: tsdoc.score || 0 },
); );
for (const pid of tdoc.pids) { for (const pid of tdoc.pids) {
const index = pid.toString().includes(':')
? `${tsdoc.uid}/${pid.toString().replace(':', '/')}`
: `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
// eslint-disable-next-line @typescript-eslint/no-use-before-define // eslint-disable-next-line @typescript-eslint/no-use-before-define
if (isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[`${tsdoc.uid}/${pid}`]?.rid?.toHexString()) { if (isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString()) {
row.push({ row.push({
type: 'records', type: 'records',
value: '', value: '',
@@ -247,8 +250,8 @@ const oi: ContestRule = {
raw: tsddict[pid]?.rid || null, raw: tsddict[pid]?.rid || null,
}, },
{ {
value: psdict[`${tsdoc.uid}/${pid}`]?.score ?? '-', value: psdict[index]?.score ?? '-',
raw: psdict[`${tsdoc.uid}/${pid}`]?.rid ?? null, raw: psdict[index]?.rid ?? null,
}, },
], ],
}); });