作者 何书鹏
1 个管道 的构建 通过 耗费 3 秒

后台查看用户考试进度

... ... @@ -64,7 +64,18 @@ class ThirdStudy extends Backend
->select();
foreach ($list as $row) {
// 学习进度
$finish_hour = Db::name('study_class')
->alias('a')
->join('classes b','a.class_id = b.id')
->where('a.third_id',$row['third_id'])
->where('a.study_id',$row['study_id'])
->where('a.status',2)
->sum('b.class_hour');
$proportion = round($finish_hour/$row['study']['class_hour']*100,0);
$row->proportion = ($proportion > 100 ? 100 : $proportion).'%';
$row->append(['proportion']);
$row->getRelation('user')->visible(['username']);
$row->getRelation('study')->visible(['examname']);
}
... ...
... ... @@ -28,6 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'user.username', title: __('Third.username')},
{field: 'study.examname', title: __('Study.examname')},
{field: 'periodtime', title: __('Periodtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'proportion', title: __('考试进度')},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...