mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: bug fix
This commit is contained in:
1 parent
ac66e3d7a2
commit
f7f977293c
6 files changed
+13
-18
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.39.27",
|
||||
"version": "2.39.28",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -85,11 +85,9 @@ async function syzojSync(info) {
|
||||
filenameList: body.testData.map((node) => node.filename),
|
||||
});
|
||||
if (r.body.error) throw new Error(r.body.error.message || r.body.error);
|
||||
const urls = {};
|
||||
for (const t of r.body.downloadInfo) urls[t.filename] = t.downloadUrl;
|
||||
for (const f of body.testData) {
|
||||
for (const f of r.body.downloadInfo) {
|
||||
const p = new PassThrough();
|
||||
superagent.get(urls[f.filename]).pipe(p);
|
||||
superagent.get(f.downloadUrl).pipe(p);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await problem.addTestdata(domainId, docId, rename[f.filename] || f.filename, p);
|
||||
}
|
||||
@@ -99,12 +97,10 @@ async function syzojSync(info) {
|
||||
type: 'AdditionalFile',
|
||||
filenameList: body.additionalFiles.map((node) => node.filename),
|
||||
});
|
||||
const aurls = {};
|
||||
if (a.body.error) throw new Error(a.body.error.message || a.body.error);
|
||||
for (const t of a.body.downloadInfo) aurls[t.filename] = t.downloadUrl;
|
||||
for (const f of body.additionalFiles) {
|
||||
for (const f of a.body.downloadInfo) {
|
||||
const p = new PassThrough();
|
||||
superagent.get(aurls[f.filename]).pipe(p);
|
||||
superagent.get(f.downloadUrl).pipe(p);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await problem.addAdditionalFile(domainId, docId, f.filename, p);
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ export class ProblemDetailHandler extends ProblemHandler {
|
||||
this.response.body = {
|
||||
pdoc: this.pdoc,
|
||||
udoc: this.udoc,
|
||||
psdoc: this.psdoc,
|
||||
title: this.pdoc.title,
|
||||
};
|
||||
this.extraTitleContent = this.pdoc.title;
|
||||
|
||||
@@ -200,7 +200,6 @@ SystemSetting(
|
||||
Setting('setting_basic', 'default.priv', builtin.PRIV.PRIV_DEFAULT, 'number', 'default.priv', 'Default Privilege', FLAG_PRO),
|
||||
Setting('setting_basic', 'discussion.nodes', builtin.DEFAULT_NODES, 'yaml', 'discussion.nodes', 'Discussion Nodes'),
|
||||
Setting('setting_basic', 'problem.categories', builtin.CATEGORIES, 'yaml', 'problem.categories', 'Problem Categories'),
|
||||
Setting('setting_basic', 'rank.uidIgnore', '', 'text', 'rank.uidIgnore', 'Ignored uids for ranking'),
|
||||
Setting('setting_basic', 'pagination.problem', 100, 'number', 'pagination.problem', 'Problems per page'),
|
||||
Setting('setting_basic', 'pagination.contest', 20, 'number', 'pagination.contest', 'Contests per page'),
|
||||
Setting('setting_basic', 'pagination.discussion', 50, 'number', 'pagination.discussion', 'Discussions per page'),
|
||||
|
||||
@@ -29,12 +29,7 @@ async function runProblem(...arg: any[]) {
|
||||
{
|
||||
docId: pdoc.docId,
|
||||
rid: { $ne: null },
|
||||
uid: {
|
||||
$nin: [
|
||||
pdoc.owner,
|
||||
...system.get('rank.uidIgnore').split(',').map((i) => +i).filter((i) => i),
|
||||
],
|
||||
},
|
||||
uid: { $ne: pdoc.owner },
|
||||
},
|
||||
).count() + 99) / 100,
|
||||
);
|
||||
@@ -68,7 +63,6 @@ async function runContest(...arg: any[]) {
|
||||
const cursor = contest.getMultiStatus(tdoc.domainId, {
|
||||
docId: tdoc.docId,
|
||||
journal: { $ne: null },
|
||||
uid: { $nin: system.get('rank.uidIgnore').split(',').map((i) => +i).filter((i) => i) },
|
||||
}).sort(contest.RULES[tdoc.rule].statusSort);
|
||||
if (!await cursor.count()) return;
|
||||
const [rankedTsdocs] = await contest.RULES[tdoc.rule].ranked(tdoc, cursor);
|
||||
@@ -166,7 +160,7 @@ async function runInDomain(id: string, isSub: boolean, report: Function) {
|
||||
const tasks = [];
|
||||
async function update(uid: number, rp: number) {
|
||||
const udoc = await UserModel.getById(id, +uid);
|
||||
const $upd: any = { $set: { rp } };
|
||||
const $upd: any = { $set: { rp: Math.max(0, rp) } };
|
||||
if (udoc.hasPriv(PRIV.PRIV_USER_PROFILE)) await domain.updateUserInDomain(id, +uid, $upd);
|
||||
}
|
||||
for (const uid in udict) tasks.push(update(+uid, udict[uid] + (deltaudict[uid] || 0)));
|
||||
|
||||
@@ -557,6 +557,11 @@ const scripts: UpgradeScript[] = [
|
||||
await db.collection('domain').updateMany({}, { $unset: { pidCounter: '' } });
|
||||
return true;
|
||||
},
|
||||
async function _50_51() {
|
||||
const _FRESH_INSTALL_IGNORE = 1;
|
||||
await db.collection('domain.user').updateMany({}, { $unset: { ratingHistory: '' } });
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
||||
export default scripts;
|
||||
Reference in new issue
Block a user