mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
core: handle problem projection
This commit is contained in:
1 parent
3daafe5396
commit
9ea781f800
5 files changed
+18
-6
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.4.18",
|
"version": "3.4.19",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export class ContestDetailHandler extends Handler {
|
|||||||
tdoc, tsdoc, udict, page,
|
tdoc, tsdoc, udict, page,
|
||||||
};
|
};
|
||||||
if (contest.isNotStarted(tdoc)) return;
|
if (contest.isNotStarted(tdoc)) return;
|
||||||
const pdict = await problem.getList(domainId, tdoc.pids, true);
|
const pdict = await problem.getList(domainId, tdoc.pids, true, undefined, undefined, problem.PROJECTION_CONTEST_LIST);
|
||||||
const psdict = {};
|
const psdict = {};
|
||||||
let rdict = {};
|
let rdict = {};
|
||||||
if (tsdoc) {
|
if (tsdoc) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class HomeworkDetailHandler extends Handler {
|
|||||||
tdoc, tsdoc, udict, ddocs, page, dpcount, dcount,
|
tdoc, tsdoc, udict, ddocs, page, dpcount, dcount,
|
||||||
};
|
};
|
||||||
if (contest.isNotStarted(tdoc)) return;
|
if (contest.isNotStarted(tdoc)) return;
|
||||||
const pdict = await problem.getList(domainId, tdoc.pids, true);
|
const pdict = await problem.getList(domainId, tdoc.pids, true, undefined, undefined, problem.PROJECTION_CONTEST_LIST);
|
||||||
const psdict = {};
|
const psdict = {};
|
||||||
let rdict = {};
|
let rdict = {};
|
||||||
if (tsdoc) {
|
if (tsdoc) {
|
||||||
|
|||||||
@@ -297,6 +297,7 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
if (!contest.canShowScoreboard(this.tdoc) || !contest.isLocked(this.tdoc)) {
|
if (!contest.canShowScoreboard(this.tdoc) || !contest.isLocked(this.tdoc)) {
|
||||||
delete this.pdoc.nAccept;
|
delete this.pdoc.nAccept;
|
||||||
delete this.pdoc.nSubmit;
|
delete this.pdoc.nSubmit;
|
||||||
|
delete this.pdoc.difficulty;
|
||||||
delete this.pdoc.stats;
|
delete this.pdoc.stats;
|
||||||
}
|
}
|
||||||
} else if (!problem.canViewBy(this.pdoc, this.user)) {
|
} else if (!problem.canViewBy(this.pdoc, this.user)) {
|
||||||
|
|||||||
@@ -28,10 +28,21 @@ function sortable(source: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ProblemModel {
|
export class ProblemModel {
|
||||||
static PROJECTION_LIST: Field[] = [
|
static PROJECTION_CONTEST_LIST: Field[] = [
|
||||||
'_id', 'domainId', 'docType', 'docId', 'pid',
|
'_id', 'domainId', 'docType', 'docId', 'pid',
|
||||||
'owner', 'title', 'nSubmit', 'nAccept', 'difficulty',
|
'owner', 'title', 'assign',
|
||||||
'tag', 'hidden', 'assign', 'stats',
|
];
|
||||||
|
|
||||||
|
static PROJECTION_LIST: Field[] = [
|
||||||
|
...ProblemModel.PROJECTION_CONTEST_LIST,
|
||||||
|
'nSubmit', 'nAccept', 'difficulty', 'tag', 'hidden',
|
||||||
|
'stats',
|
||||||
|
];
|
||||||
|
|
||||||
|
static PROJECTION_CONTEST_DETAIL: Field[] = [
|
||||||
|
...ProblemModel.PROJECTION_CONTEST_LIST,
|
||||||
|
'content', 'html', 'data', 'config', 'additional_file',
|
||||||
|
'reference',
|
||||||
];
|
];
|
||||||
|
|
||||||
static PROJECTION_PUBLIC: Field[] = [
|
static PROJECTION_PUBLIC: Field[] = [
|
||||||
|
|||||||
Reference in new issue
Block a user