ui: better training validation output

This commit is contained in:
undefined committed 2022-08-09 20:35:44 +08:00
1 parent 9a44422522
commit 6bda0e58d3
9 files changed
+13 -6

No files matched your search

+1
View File
@@ -202,6 +202,7 @@ export class ProblemModel {
static async copy(domainId: string, _id: number, target: string, pid?: string) {
const original = await ProblemModel.get(domainId, _id);
if (!original) throw new ProblemNotFoundError(domainId, _id);
// TODO: refuse to copy referenced problem
if (pid && (/^[0-9]+$/.test(pid) || await ProblemModel.get(target, pid))) pid = '';
if (!pid && original.pid && !await ProblemModel.get(target, original.pid)) pid = original.pid;
const docId = await ProblemModel.add(