core&ui: add training maintainer

This commit is contained in:
panda committed 2023-07-04 21:33:16 +00:00
1 parent bd95b9bd83
commit 79504ed900
5 files changed
+18 -8

No files matched your search

+2 -1
View File
@@ -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: 类型
+5 -5
View File
@@ -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 };
+3 -2
View File
@@ -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,
});
}
+1
View File
@@ -893,6 +893,7 @@ Total Score: 总分数
Total Time (Seconds): 总耗时 (秒)
Total Time: 总耗时
Total: 总计
Training Maintainer: 训练管理员
Training requirement is not satisfied.: 不满足训练条件。
training_create: 创建训练
training_edit: 编辑训练
@@ -26,6 +26,13 @@
<p class="help-text">{{ _('Introduce must not exceed 500 characters and it will be shown in the list view.') }}</p>
</label>
</div></div>
{{ form.form_text({
columns:12,
label:'Training Maintainer',
name:'maintainer',
help_text:_('Allow to maintain this {0}').format(_('training')),
value:tdoc.maintainer|default('')
}) }}
<div class="row"><div class="columns">
<label>
{{ _('Description') }}