mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix import-syzoj (#61)
Co-authored-by: Macesuted <macesuted@qq.com>
This commit is contained in:
1 parent
193b0dfa9d
commit
9cfdbe3aa9
1 file changed
+8
-2
@@ -132,11 +132,14 @@ class ProblemImportSYZOJHandler extends Handler {
|
|||||||
protocol: string, host: string, pid: string | number,
|
protocol: string, host: string, pid: string | number,
|
||||||
wait = false,
|
wait = false,
|
||||||
) {
|
) {
|
||||||
|
let tagsOfLocale = this.user.viewLang || this.session.viewLang;
|
||||||
|
if (tagsOfLocale === 'en') tagsOfLocale = 'en_US';
|
||||||
|
else tagsOfLocale = 'zh_CN';
|
||||||
const result = await superagent.post(`${protocol}://${host === 'loj.ac' ? 'api.loj.ac.cn' : host}/api/problem/getProblem`)
|
const result = await superagent.post(`${protocol}://${host === 'loj.ac' ? 'api.loj.ac.cn' : host}/api/problem/getProblem`)
|
||||||
.send({
|
.send({
|
||||||
displayId: +pid,
|
displayId: +pid,
|
||||||
localizedContentsOfAllLocales: true,
|
localizedContentsOfAllLocales: true,
|
||||||
tagsOfLocale: this.user.viewLang || this.session.viewLang,
|
tagsOfLocale,
|
||||||
samples: true,
|
samples: true,
|
||||||
testData: true,
|
testData: true,
|
||||||
additionalFiles: true,
|
additionalFiles: true,
|
||||||
@@ -154,7 +157,10 @@ class ProblemImportSYZOJHandler extends Handler {
|
|||||||
delete section.sampleId;
|
delete section.sampleId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
content[c.locale] = sections;
|
let locale = c.locale;
|
||||||
|
if (locale === 'en_US') locale = 'en';
|
||||||
|
else if (locale === 'zh_CN') locale = 'zh';
|
||||||
|
content[locale] = sections;
|
||||||
}
|
}
|
||||||
const tags = result.body.tagsOfLocale.map((node) => node.name);
|
const tags = result.body.tagsOfLocale.map((node) => node.name);
|
||||||
const title = [
|
const title = [
|
||||||
|
|||||||
Reference in new issue
Block a user