From f27e7705acebebbe6387015c3925e58e7dea89bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Sat, 26 Dec 2020 19:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E6=88=90=E7=BB=A9=E4=B8=AD=E5=85=A8=E7=A7=91=E5=8F=8A?= =?UTF-8?q?=E6=A0=BC=E7=8E=87=E9=94=99=E8=AF=AF=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=A8=E7=A7=91=E4=BC=98=E7=A7=80=E7=8E=87=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chengji/controller/Index.php | 2 +- app/chengji/model/Tongji.php | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 0aabdc47..0de1690b 100755 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -391,7 +391,7 @@ class Index extends AdminBase $sheet->setCellValue($colname[$colBiankuang] . '11', $temp['cj']['all']['avg']); $sheet->mergeCells($colname[$colBiankuang] . '11:' . $colname[$colcnt - 1] . '11'); $sheet->setCellValue($colname[$colBiankuang - 1] . '12', '全科及格率%'); - $sheet->setCellValue($colname[$colBiankuang] . '12', $temp['cj']['all']['jige']); + $sheet->setCellValue($colname[$colBiankuang] . '12', $temp['cj']['all']['jigelv']); $sheet->mergeCells($colname[$colBiankuang] . '12:' . $colname[$colcnt - 1] . '12'); $sheet->getStyle($colname[$colBiankuang - 1] . '3:' . $colname[$colcnt - 1] . '12')->applyFromArray($styleArrayJZ); $sheet->getStyle($colname[$colBiankuang - 1] . '3:' . $colname[$colcnt - 1] . '12')->applyFromArray($styleArrayBK); diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php index 6dcbdad4..9f1f950c 100755 --- a/app/chengji/model/Tongji.php +++ b/app/chengji/model/Tongji.php @@ -107,12 +107,14 @@ class Tongji extends BaseModel $temp['avg'] = round($temp['avg'], 2); $temp['max'] = max($cjcol); $temp['min'] = min($cjcol); - $temp['youxiu'] = null; - $temp['jige'] = $this->rateAll($cj, $subject); #全科及格率 + $temp['youxiu'] = $this->rateAll($cj, $subject, 'youxiu'); + $temp['jige'] = $this->rateAll($cj, $subject, 'jige'); #全科及格率 $temp['sifenwei'] = $this->myquartile($cjcol); $temp['zhongshu'] = $this->zhongshu($cjcol); $temp['zhongweishu'] = $this->zhongweishu($cjcol); $temp['defenlv'] = round($temp['defenlv'] * 100, 2); + $temp['youxiulv'] = round($temp['youxiu'] / $temp['xkcnt'] * 100, 2); + $temp['jigelv'] = round($temp['jige'] / $temp['xkcnt'] * 100, 2); } $data['cj']['all'] = $temp; @@ -134,7 +136,7 @@ class Tongji extends BaseModel // 全科及格率 - public function rateAll($cj = array(), $sbj = array()) + public function rateAll($cj = array(), $sbj = array(), $category = 'jige') { $jige = 0; # 总及格人数 $row = 0; #记录有成绩的学生数 @@ -146,7 +148,7 @@ class Tongji extends BaseModel // 开始循环这个学生的每个学科成绩 foreach ($sbj as $k => $val) { if (isset($value[$val['lieming']])) { - if ($value[$val['lieming']] >= $val['fenshuxian']['jige']) { + if ($value[$val['lieming']] >= $val['fenshuxian'][$category]) { $temjige ++; } if ($value[$val['lieming']] !== null) {