添加各分数段统计

This commit is contained in:
win10 committed 2020-07-03 15:42:49 +08:00
1 parent 4ae8dec3a5
commit 2a1bd45a57
13 files changed
+441 -21

No files matched your search

+64
View File
@@ -80,6 +80,37 @@ class Bjtongji extends BaseController
}
// 班级成绩汇总
public function fenshuduan($kaoshi_id)
{
// 获取考试信息
$ks = new \app\kaoshi\model\Kaoshi;
$ksinfo = $ks->where('id', $kaoshi_id)
->field('id, title')
->find();
// 获取参与学校
$khSrc = new \app\kaohao\model\Search;
$src['kaoshi_id'] = $kaoshi_id;
$list['school_id'] = $khSrc->cySchool($src);
// 获取年级与学科
$ksset = new \app\kaoshi\model\KaoshiSet;
$list['nianji'] = $ksset->srcNianji($kaoshi_id);
$list['subject_id'] = $ksset->srcSubject($kaoshi_id, '', '');
// 设置要给模板赋值的信息
$list['webtitle'] = '各年级的班级成绩列表';
$list['kaoshi_id'] = $kaoshi_id;
$list['kaoshititle'] = $ksinfo->title;
$list['dataurl'] = '/';
// 模板赋值
$this->view->assign('list', $list);
// 渲染模板
return $this->view->fetch();
}
// 年级、班级学生成绩统计结果下载界面
public function dwBiaoge($kaoshi_id)
{
@@ -378,4 +409,37 @@ class Bjtongji extends BaseController
}
// 分数段
public function myFenshuduan($kaoshi_id)
{
// 获取参数
$src = $this->request
->only([
'kaoshi_id' => ''
,'ruxuenian' => ''
,'school_id' => array()
,'banji_id' => array()
,'subject_id' => ''
], 'POST');
if (count($src['banji_id']) == 0) {
// 获取参与考试的班级
$khSrc = new \app\kaohao\model\Search;
$src['banji_id']= array_column($khSrc->cyBanji($src), 'id');
}
// 统计成绩
$btj = new BTJ;
$fsd = $btj->tjBanjiFenshuduan($src);
$data = array();
foreach ($fsd as $key => $value) {
$data['xAxis'][] = (string)$value['low'].'~'.$value['high'];
$data['series'][] = $value['cnt'];
}
return json($data);
}
}
+2 -4
View File
@@ -83,7 +83,6 @@ class Tongji extends BaseModel
$temp['zhongshu'] = $this->zhongshu($cjcol);
$temp['zhongweishu'] = $this->zhongweishu($cjcol);
$temp['defenlv'] = round($temp['defenlv'] * 100, 2);
$temp['fenshuduan'] = $this->fenshuduan($cjcol, $value['fenshuxian']['manfen']);
}
$data['cj'][$value['lieming']] = $temp;
}
@@ -114,7 +113,6 @@ class Tongji extends BaseModel
$temp['zhongshu'] = $this->zhongshu($cjcol);
$temp['zhongweishu'] = $this->zhongweishu($cjcol);
$temp['defenlv'] = round($temp['defenlv'] * 100, 2);
$temp['fenshuduan'] = $this->fenshuduan($cjcol, $value['fenshuxian']['manfen']);
}
$data['cj']['all'] = $temp;
@@ -304,8 +302,8 @@ class Tongji extends BaseModel
}
// 分数段统计
public function fenshuduan($arr, $manfen)
// 根据给定数据统计分数段
public function fenshuduan($arr = array(), $manfen = 0)
{
// 计算分数段
$fenshuduan = array();
+53
View File
@@ -150,6 +150,59 @@ class TongjiBj extends BaseModel
}
// 统计各学科分数频率
public function tjBanjiFenshuduan($srcfrom)
{
// 初始化参数
$src = array(
'page' => '1'
,'limit' => '10'
,'kaoshi_id' => ''
,'banji_id' => array()
,'ruxuenian' => ''
,'subject_id' => ''
);
$src = array_cover($srcfrom, $src);
$src['banji_id'] = strToArray($src['banji_id']);
// 实例化学生成绩统计类
$tj = new TJ;
$khSrc = new \app\kaohao\model\Search;
$ksset = new \app\kaoshi\model\KaoshiSet;
// 获取参加考试学科
$subject = $ksset->srcSubject($src['kaoshi_id'], '', $src['ruxuenian']);
$fsx = 0;
$lieming = 'lieming';
foreach ($subject as $key => $value) {
if ($value['id'] == $src['subject_id'])
{
$fsx = $value['fenshuxian']['manfen'];
$lieming = $value['lieming'];
}
}
// 获取并统计各班级成绩
$data = array();
$cj = $khSrc->srcChengjiList($src);
if (array_key_exists($lieming, $cj[0]))
{
$cjcol = array_column($cj, $lieming);
$cjcol = array_filter($cjcol, function($item){
return $item !== null;
});
if (count($cjcol) > 0)
{
$data = $tj->fenshuduan($cjcol, $fsx);
}
}
return $data;
}
// 根据条件查询各班级成绩
public function search($srcfrom)
{
Loaded 3 of 13 files, more files were not shown because too many files have changed in this diff. Show more