core: use alpha-indexed id in contest

This commit is contained in:
undefined committed 2021-05-29 12:29:03 +08:00
1 parent 8852aa149b
commit 800b332c8b
8 files changed
+39 -33

No files matched your search

+2 -2
View File
@@ -247,8 +247,8 @@ export class ProblemModel {
const l = {};
const ddocs = await Promise.all(Object.keys(parsed).map((i) => domain.get(i)));
const f = ddocs.filter((i) => !(
i.share === '*'
|| (`,${(i.share || '').replace(/,/g, ',').split(',').map((q) => q.trim()).join(',')},`).includes(`,${domainId},`)
i?.share === '*'
|| (`,${(i?.share || '').replace(/,/g, ',').split(',').map((q) => q.trim()).join(',')},`).includes(`,${domainId},`)
));
if (f.length) {
if (doThrow) throw new ProblemNotFoundError(f[0]._id, parsed[f[0]._id][0].pid);