班级成绩列表
This commit is contained in:
1 parent
53c4b2d370
commit
7db5895f6a
6 files changed
+44
-32
No files matched your search
@@ -239,7 +239,6 @@ class Index extends Base
|
||||
$list['subject'] = $ksinfo->ks_subject;
|
||||
$list['kaoshi'] = $kaoshi;
|
||||
|
||||
|
||||
// 模板赋值
|
||||
$this->assign('list',$list);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ class Tongji extends Base
|
||||
$list['webtitle'] = '各年级的班级成绩列表';
|
||||
$list['kaoshi'] = $kaoshi;
|
||||
|
||||
|
||||
// 模板赋值
|
||||
$this->assign('list',$list);
|
||||
|
||||
@@ -97,7 +98,6 @@ class Tongji extends Base
|
||||
'data'=>array(), //获取到的数据结果
|
||||
];
|
||||
|
||||
|
||||
return json($data);
|
||||
}
|
||||
|
||||
@@ -106,10 +106,12 @@ class Tongji extends Base
|
||||
// 获取并统计各班级成绩
|
||||
$tj = new TJ;
|
||||
$data = array();
|
||||
$allcj = array();
|
||||
foreach ($bj as $key => $value) {
|
||||
$banji=[$value->banji];
|
||||
$nianji = array();
|
||||
$temp = $tj->srcChengji($src['kaoshi'],$banji,$nianji);
|
||||
$allcj = array_merge($allcj, $temp);;
|
||||
$temp = $tj->tongji($temp,$src['kaoshi']);
|
||||
$data[] = [
|
||||
'banji'=>$value->cj_banji->banjiTitle,
|
||||
@@ -117,7 +119,7 @@ class Tongji extends Base
|
||||
'chengji'=>$temp
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$cnt = count($data);
|
||||
|
||||
// 重组返回内容
|
||||
|
||||
@@ -111,21 +111,45 @@ class Tongji extends Model
|
||||
->with('ksSubject')
|
||||
->find();
|
||||
$data = array();
|
||||
$allcj = array();
|
||||
foreach ($ksinfo->ks_subject as $key => $value) {
|
||||
$cjcol = array_column($cj,$value->lieming);
|
||||
$allcj = array_merge($allcj,$cjcol);
|
||||
$temp = array();
|
||||
$temp['cnt'] = count($cjcol);
|
||||
$temp['sum'] = array_sum($cjcol);
|
||||
$temp['cnt']>0 ? $temp['avg'] = $temp['sum']/$temp['cnt'] : $temp['avg']=0;
|
||||
$temp['biaozhuncha'] = round($this->getVariance($temp['avg'], $cjcol,true),2);
|
||||
$temp['avg'] = round($temp['avg'],1);
|
||||
$temp['youxiu'] = $this->rate($cjcol,$value->youxiu);
|
||||
$temp['jige'] = $this->rate($cjcol,$value->jige);
|
||||
$temp['sifenwei'] = $this->quartile($cjcol);
|
||||
$data[$value->lieming] = $temp;
|
||||
}
|
||||
$data['cnt'] = count($allcj);
|
||||
$data['sum'] = array_sum($allcj);
|
||||
$data['cnt']>0 ? $data['avg'] = $data['sum']/$data['cnt'] : $data['avg']=0;
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
// 统计优秀、及格率
|
||||
public function rate($cj = array(),$fenshuxian)
|
||||
{
|
||||
$cnt = 0;
|
||||
foreach ($cj as $key => $value) {
|
||||
if($value>=$fenshuxian)
|
||||
{
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
return round($cnt/count($cj)*100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user