mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: script: 修复脚本回显错误的问题
This commit is contained in:
1 parent
12c43a9635
commit
6c6a0df0f0
4 files changed
+13
-8
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.15.29",
|
"version": "2.15.30",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -82,14 +82,14 @@ class RecordDetailHandler extends RecordHandler {
|
|||||||
problem.get(domainId, rdoc.pid),
|
problem.get(domainId, rdoc.pid),
|
||||||
user.getById(domainId, rdoc.uid),
|
user.getById(domainId, rdoc.uid),
|
||||||
]);
|
]);
|
||||||
|
if (!(pdoc && this.user.hasPerm(PERM.PERM_VIEW_PROBLEM))) {
|
||||||
|
pdoc = problem.Pdoc.create(pdoc?.docId || 0, pdoc?.pid || '*');
|
||||||
|
}
|
||||||
if (!rdoc.contest && pdoc.hidden && pdoc.owner !== this.user._id) {
|
if (!rdoc.contest && pdoc.hidden && pdoc.owner !== this.user._id) {
|
||||||
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) {
|
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) {
|
||||||
pdoc = problem.Pdoc.create(pdoc.docId, pdoc.pid);
|
pdoc = problem.Pdoc.create(pdoc.docId, pdoc.pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) {
|
|
||||||
pdoc = problem.Pdoc.create(pdoc.docId, pdoc.pid);
|
|
||||||
}
|
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
path: [
|
path: [
|
||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ export async function run() {
|
|||||||
];
|
];
|
||||||
const bulk = db.collection('document').initializeUnorderedBulkOp();
|
const bulk = db.collection('document').initializeUnorderedBulkOp();
|
||||||
db.collection('record').aggregate(pipeline).each(
|
db.collection('record').aggregate(pipeline).each(
|
||||||
(err, adoc: any) => bulk.find({
|
(err, adoc: any) => {
|
||||||
|
if (adoc) {
|
||||||
|
bulk.find({
|
||||||
domainId: adoc._id.domainId,
|
domainId: adoc._id.domainId,
|
||||||
docType: document.TYPE_PROBLEM,
|
docType: document.TYPE_PROBLEM,
|
||||||
docId: adoc._id.pid,
|
docId: adoc._id.pid,
|
||||||
@@ -39,9 +41,11 @@ export async function run() {
|
|||||||
nSubmit: adoc.nSubmit,
|
nSubmit: adoc.nSubmit,
|
||||||
nAccept: adoc.nAccept,
|
nAccept: adoc.nAccept,
|
||||||
},
|
},
|
||||||
}),
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
await bulk.execute();
|
if (bulk.length) await bulk.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validate = {};
|
export const validate = {};
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ async function runInDomain(domainId: string, isSub: boolean, report: Function) {
|
|||||||
for (const dudoc of dudocs) {
|
for (const dudoc of dudocs) {
|
||||||
deltaudict[dudoc.uid] = dudoc.rpdelta || 0;
|
deltaudict[dudoc.uid] = dudoc.rpdelta || 0;
|
||||||
}
|
}
|
||||||
const contests = await contest.getMulti(domainId, { rated: true }).sort('endAt', -1).toArray();
|
const contests = await contest.getMulti(domainId, { rated: true })
|
||||||
|
.sort('endAt', -1).toArray();
|
||||||
await report({ message: `Found ${contests.length} contests in ${domainId}` });
|
await report({ message: `Found ${contests.length} contests in ${domainId}` });
|
||||||
for (const i in contests) {
|
for (const i in contests) {
|
||||||
const tdoc = contests[i];
|
const tdoc = contests[i];
|
||||||
|
|||||||
Reference in new issue
Block a user