修改下载班级成绩中全科及格率错误,增加全科优秀率计算

This commit is contained in:
巴掌 committed 2020-12-26 19:54:40 +08:00
1 parent b09fde2b3e
commit f27e7705ac
2 files changed
+7 -5

No files matched your search

+1 -1
View File
@@ -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);
+6 -4
View File
@@ -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) {