diff --git a/packages/hydrooj/locales/zh.yaml b/packages/hydrooj/locales/zh.yaml index 3857b9036..516a19ec6 100644 --- a/packages/hydrooj/locales/zh.yaml +++ b/packages/hydrooj/locales/zh.yaml @@ -518,8 +518,8 @@ Numeric PID: 数字题号 Oh, the user doesn't have any contributions!: 啊哦,这个用户还没贡献过题目~ Oh, the user hasn't created any discussions yet!: 这个用户还没有发布过讨论 Oh, the user hasn't submitted yet!: 这个用户还没有交过题 _(:зゝ∠)_ -Oh, there is no task in the queue!: 喔,队列中目前没有任务。 Oh, there are no tasks that match the filter!: 喔,目前没有符合过滤条件的任务。 +Oh, there is no task in the queue!: 喔,队列中目前没有任务。 Ok: 确定 Only A-Z, a-z, 0-9 and _ are accepted: 只接受 A-Z, a-z, 0-9 和 _ Oops, there are no results.: 呀,没有结果。 @@ -804,6 +804,7 @@ training_create: 创建训练 training_detail: 训练详情 training_edit: 编辑训练 training_main: 训练 +training: 训练 Training: 训练 Trainings per page: 每页展示的训练数量 Type: 类型 diff --git a/packages/hydrooj/src/handler/training.ts b/packages/hydrooj/src/handler/training.ts index 78fcda2b6..aac15e49e 100644 --- a/packages/hydrooj/src/handler/training.ts +++ b/packages/hydrooj/src/handler/training.ts @@ -206,20 +206,20 @@ class TrainingEditHandler extends Handler { @param('dag', Types.Content) @param('pin', Types.UnsignedInt) @param('description', Types.Content) + @param('maintainer', Types.NumericArray, true) async post( - domainId: string, tid: ObjectId, - title: string, content: string, - _dag: string, pin = 0, description: string, + domainId: string, tid: ObjectId, title: string, content: string, + _dag: string, pin = 0, description: string, maintainer: number[] = [], ) { if ((!!this.tdoc?.pin) !== (!!pin)) this.checkPerm(PERM.PERM_PIN_TRAINING); const dag = await _parseDagJson(domainId, _dag); const pids = training.getPids(dag); assert(pids.length, new ValidationError('dag', null, 'Please specify at least one problem')); if (!tid) { - tid = await training.add(domainId, title, content, this.user._id, dag, description, pin); + tid = await training.add(domainId, title, content, this.user._id, dag, description, pin, maintainer); } else { await training.edit(domainId, tid, { - title, content, dag, description, pin, + title, content, dag, description, pin, maintainer, }); } this.response.body = { tid }; diff --git a/packages/hydrooj/src/model/training.ts b/packages/hydrooj/src/model/training.ts index e4182bbb5..6249cd145 100644 --- a/packages/hydrooj/src/model/training.ts +++ b/packages/hydrooj/src/model/training.ts @@ -35,8 +35,8 @@ export function setStatus(domainId: string, tid: ObjectId, uid: number, $set: an } export function add( - domainId: string, title: string, content: string, - owner: number, dag: TrainingNode[] = [], description = '', pin = 0, + domainId: string, title: string, content: string, owner: number, + dag: TrainingNode[] = [], description = '', pin = 0, maintainer: number[] = [], ) { return document.add(domainId, content, owner, document.TYPE_TRAINING, null, null, null, { dag, @@ -44,6 +44,7 @@ export function add( description, attend: 0, pin, + maintainer, }); } diff --git a/packages/ui-default/locales/zh.yaml b/packages/ui-default/locales/zh.yaml index f2ab458a8..06a7b68d3 100644 --- a/packages/ui-default/locales/zh.yaml +++ b/packages/ui-default/locales/zh.yaml @@ -893,6 +893,7 @@ Total Score: 总分数 Total Time (Seconds): 总耗时 (秒) Total Time: 总耗时 Total: 总计 +Training Maintainer: 训练管理员 Training requirement is not satisfied.: 不满足训练条件。 training_create: 创建训练 training_edit: 编辑训练 diff --git a/packages/ui-default/templates/training_edit.html b/packages/ui-default/templates/training_edit.html index 3cd3e598d..877f08966 100644 --- a/packages/ui-default/templates/training_edit.html +++ b/packages/ui-default/templates/training_edit.html @@ -26,6 +26,13 @@

{{ _('Introduce must not exceed 500 characters and it will be shown in the list view.') }}

+ {{ form.form_text({ + columns:12, + label:'Training Maintainer', + name:'maintainer', + help_text:_('Allow to maintain this {0}').format(_('training')), + value:tdoc.maintainer|default('') + }) }}