mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core&ui: pagination for homework
This commit is contained in:
1 parent
7c0301c3e0
commit
5baf8f3207
6 files changed
+28
-24
No files matched your search
+4
-4
@@ -34,10 +34,10 @@
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@types/node": "^18.11.3",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
||||
"@typescript-eslint/parser": "^5.40.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
||||
"@typescript-eslint/parser": "^5.41.0",
|
||||
"autocannon": "^7.10.0",
|
||||
"cac": "^6.7.14",
|
||||
"cross-env": "^7.0.3",
|
||||
@@ -62,7 +62,7 @@
|
||||
"nyc": "^15.1.0",
|
||||
"ora": "^6.1.2",
|
||||
"semver": "^7.3.8",
|
||||
"supertest": "^6.3.0",
|
||||
"supertest": "^6.3.1",
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"packageManager": "yarn@3.2.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "4.2.13",
|
||||
"version": "4.2.14",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
@@ -12,11 +12,11 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.194.0",
|
||||
"@aws-sdk/lib-storage": "^3.194.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.193.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.194.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.194.0",
|
||||
"@aws-sdk/client-s3": "^3.198.0",
|
||||
"@aws-sdk/lib-storage": "^3.198.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.198.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.198.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.198.0",
|
||||
"@graphql-tools/schema": "^8.5.1",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"adm-zip": "0.5.5",
|
||||
@@ -53,7 +53,7 @@
|
||||
"serialize-javascript": "^6.0.0",
|
||||
"superagent": "^8.0.2",
|
||||
"thirty-two": "^1.0.2",
|
||||
"ws": "^8.9.0"
|
||||
"ws": "^8.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/adm-zip": "^0.4.34",
|
||||
@@ -69,7 +69,7 @@
|
||||
"@types/nodemailer": "^6.4.6",
|
||||
"@types/notp": "^2.0.2",
|
||||
"@types/saslprep": "^1.0.1",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/serialize-javascript": "^5.0.2",
|
||||
"@types/superagent": "^4.1.15",
|
||||
"moment": "^2.29.4"
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
ContestNotFoundError, ForbiddenError, HomeworkNotLiveError,
|
||||
ValidationError,
|
||||
} from '../error';
|
||||
import { PenaltyRules } from '../interface';
|
||||
import { PenaltyRules, Tdoc } from '../interface';
|
||||
import paginate from '../lib/paginate';
|
||||
import { PERM } from '../model/builtin';
|
||||
import * as contest from '../model/contest';
|
||||
@@ -22,8 +22,9 @@ const validatePenaltyRules = (input: string) => yaml.load(input);
|
||||
const convertPenaltyRules = validatePenaltyRules;
|
||||
|
||||
class HomeworkMainHandler extends Handler {
|
||||
async get({ domainId }) {
|
||||
const tdocs = await contest.getMulti(domainId, { rule: 'homework' }).toArray();
|
||||
async get({ domainId, page = 1 }) {
|
||||
const cursor = contest.getMulti(domainId, { rule: 'homework' });
|
||||
const [tdocs, tpcount] = await paginate<Tdoc>(cursor, page, system.get('pagination.contest'));
|
||||
const calendar = [];
|
||||
for (const tdoc of tdocs) {
|
||||
const cal = { ...tdoc, url: this.url('homework_detail', { tid: tdoc.docId }) };
|
||||
@@ -33,7 +34,9 @@ class HomeworkMainHandler extends Handler {
|
||||
} else cal.endAt = tdoc.penaltySince;
|
||||
calendar.push(cal);
|
||||
}
|
||||
this.response.body = { tdocs, calendar };
|
||||
this.response.body = {
|
||||
tdocs, calendar, tpcount, page,
|
||||
};
|
||||
this.response.template = 'homework_main.html';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.42.12",
|
||||
"version": "4.42.13",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "index.ts",
|
||||
@@ -21,7 +21,7 @@
|
||||
"@fontsource/source-code-pro": "^4.5.12",
|
||||
"@fontsource/ubuntu-mono": "^4.5.11",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"@svgr/webpack": "^6.5.0",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
"@types/gulp-if": "^0.0.34",
|
||||
"@types/jquery": "^3.5.14",
|
||||
"@types/json-schema": "^7.0.11",
|
||||
@@ -29,13 +29,13 @@
|
||||
"@types/markdown-it": "^12.2.3",
|
||||
"@types/pickadate": "^3.5.32",
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@types/redux-logger": "^3.0.9",
|
||||
"@types/serviceworker": "^0.0.53",
|
||||
"@types/sharedworker": "^0.0.82",
|
||||
"@types/serviceworker": "^0.0.54",
|
||||
"@types/sharedworker": "^0.0.83",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@vscode/codicons": "^0.0.32",
|
||||
"autoprefixer": "^10.4.12",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"browser-update": "^3.3.44",
|
||||
"chalk": "^5.1.2",
|
||||
"classnames": "^2.3.2",
|
||||
@@ -111,7 +111,7 @@
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"web-streams-polyfill": "^3.2.1",
|
||||
"webpack": "^5.74.0",
|
||||
"webpack-bundle-analyzer": "^4.6.1",
|
||||
"webpack-bundle-analyzer": "^4.7.0",
|
||||
"webpack-dev-server": "^4.11.1",
|
||||
"webpack-manifest-plugin": "^5.0.0",
|
||||
"webpackbar": "^5.0.2"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ol>
|
||||
{{ paginator.render(page, tpcount) }}
|
||||
<div name="calendar_entry"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"mongodb": "^3.7.3",
|
||||
"reggol": "^1.3.1",
|
||||
"source-map-support": "^0.5.21",
|
||||
"systeminformation": "^5.12.8"
|
||||
"systeminformation": "^5.12.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
|
||||
Reference in new issue
Block a user