mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: fix #848
This commit is contained in:
1 parent
1954208d36
commit
62613937cf
1 file changed
+3
-2
@@ -84,13 +84,14 @@ class AccountService {
|
||||
}
|
||||
if (id.search('\\\\#') !== -1) continue;
|
||||
const [pid, metastr = '{}'] = id.split('#');
|
||||
const normalizedPid = pid.replace(/[_-]/g, '');
|
||||
const meta = JSON.parse(metastr);
|
||||
if (await ProblemModel.get(domainId, pid) || syncing[`${domainId}/${pid}`]) continue;
|
||||
if (await ProblemModel.get(domainId, normalizedPid) || syncing[`${domainId}/${pid}`]) continue;
|
||||
syncing[`${domainId}/${pid}`] = true;
|
||||
try {
|
||||
const res = await this.api.getProblem(pid, meta);
|
||||
if (!res) continue;
|
||||
const docId = await ProblemModel.add(domainId, pid, res.title, res.content, 1, res.tag);
|
||||
const docId = await ProblemModel.add(domainId, normalizedPid, res.title, res.content, 1, res.tag);
|
||||
if (res.difficulty) await ProblemModel.edit(domainId, docId, { difficulty: res.difficulty });
|
||||
for (const key in res.files) {
|
||||
await ProblemModel.addAdditionalFile(domainId, docId, key, res.files[key]);
|
||||
|
||||
Reference in new issue
Block a user