diff --git a/application/chengji/controller/Index.php b/application/chengji/controller/Index.php index 561cbf5f..bc8b8135 100644 --- a/application/chengji/controller/Index.php +++ b/application/chengji/controller/Index.php @@ -625,7 +625,7 @@ class Index extends Base ->only([ 'page'=>'1', 'limit'=>'10', - 'field'=>'subject_id', + 'field'=>'banji', 'type'=>'desc', 'kaohao'=>'' ],'POST'); diff --git a/application/chengji/model/Chengji.php b/application/chengji/model/Chengji.php index 1dc31e62..a2797a69 100644 --- a/application/chengji/model/Chengji.php +++ b/application/chengji/model/Chengji.php @@ -15,6 +15,94 @@ class Chengji extends Base return $this->belongsTo('\app\teach\model\Subject'); } + // /** + // * 根据考试ID和班级获取学生各学科成绩、平均分、总分 + // * + // * @access public + // * @param mixed $kaoshi 当前考试ID + // * @param array $banji 学生所在班级 + // * @return array 返回类型 + // */ + // public function srcChengji($kaoshi=0,$banji=array()) + // { + // $kh = new \app\kaoshi\model\Kaohao; + // $khlist = $kh->where('kaoshi',$kaoshi) + // ->field('id,school,student,nianji,banji') + // ->when(count($banji)>0,function($query) use($banji){ + // $query->where('banji','in',$banji); + // }) + // ->with([ + // 'ksChengji'=>function($query){ + // $query->field('kaohao_id,subject_id,defen'); + // } + // ,'cjBanji'=>function($query){ + // $query->field('id,paixu,ruxuenian') + // ->append(['numTitle','banjiTitle']); + // } + // ,'cjSchool'=>function($query){ + // $query->field('id,jiancheng'); + // } + // ,'cjStudent'=>function($query){ + // $query->field('id,xingming,sex'); + // } + // ]) + // ->select(); + + + // // 获取参考学科 + // $ks = new \app\kaoshi\model\Kaoshi; + // $ksinfo = $ks->where('id',$kaoshi) + // ->with([ + // 'ksSubject'=>function($query){ + // $query->field('kaoshiid,subjectid,lieming'); + // } + // ]) + // ->find(); + // $xk = array(); + // foreach ($ksinfo->ks_subject as $key => $value) { + // $xk[$value->subjectid] = $value->lieming; + // } + + + // // 整理数据 + // $data = array(); + // foreach ($khlist as $key => $value) { + // $data[$key]['id'] = $value->id; + // $data[$key]['school'] = $value->cj_school->jiancheng; + // if(isset($value->cj_student)){ + // $data[$key]['student'] = $value->cj_student->xingming; + // $data[$key]['sex'] = $value->cj_student->sex; + // }else{ + // $stu = new \app\renshi\model\Student; + // $stuname = $stu::withTrashed()->where('id',$value->student)->field('id,xingming,sex')->find(); + // $data[$key]['student'] = $stuname->xingming; + // $data[$key]['sex'] = $stuname->sex; + // } + // $data[$key]['nianji'] = $value->nianji; + // $data[$key]['banji'] = $value->cj_banji->banji_title; + // $dfsum = 0; + // $sbjcnt = 0; + // foreach ($value->ks_chengji as $k => $val) { + // $data[$key][$xk[$val->subject_id]] = $val->defen*1; + // $dfsum = $dfsum + $val->defen*1; + // $sbjcnt ++; + // } + // $data[$key]['sum'] = $dfsum; + // if($sbjcnt>0){ + // $data[$key]['avg'] = round($dfsum/$sbjcnt,1); + // }else{ + // $data[$key]['avg'] = 0; + // } + // } + + // // // 按条件排序 + // // if(count($data)>0){ + // // $data = arraySequence($data,$src['field'],$src['type']); //排序 + // // } + // return $data; + // } + + // 学科关联 public function subjectName() { diff --git a/application/chengji/model/Tongji.php b/application/chengji/model/Tongji.php index dba349d9..373baa07 100644 --- a/application/chengji/model/Tongji.php +++ b/application/chengji/model/Tongji.php @@ -82,15 +82,7 @@ class Tongji extends Model - /** - * 统计全样本成绩 - * 包括:数量、合计、标准差、平均、优秀、及格、四分位 - * 全科及格率、全科平均分 - * @access public - * @param array $cj 成绩 - * @param number $kaoshi 考试ID - * @return array 返回类型 - */ + // 统计成绩 public function tongji($cj=array(),$kaoshi) { @@ -100,9 +92,20 @@ class Tongji extends Model ->with('ksSubject') ->find(); $data = array(); + $allcj = array(); foreach ($ksinfo->ks_subject as $key => $value) { $cjcol = array_column($cj,$value->lieming); - $data[$value->lieming] = $this->tj($cjcol,$value->youxiu,$value->jige); + $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'],2); + $temp['youxiu'] = $this->rate($cjcol,$value->youxiu); + $temp['jige'] = $this->rate($cjcol,$value->jige); + $temp['sifenwei'] = $this->quartile($cjcol); + $data[$value->lieming] = $temp; } $cjcol = array_column($cj,'sum'); $data['cnt'] = count($cjcol); @@ -118,30 +121,6 @@ class Tongji extends Model } - /** - * 统计给定一维数组的成绩 - * 包括:数量、合计、标准差、平均、优秀、及格、四分位 - * @access public - * @param array $cj 成绩 - * @param number $youxiu 优秀分数线 - * @param number $jige 优秀分数线 - * @return array 返回类型 - */ - public function tj($cj=array(),$youxiu,$jige) - { - $temp = array(); - $temp['cnt'] = count($cj); - $temp['sum'] = array_sum($cj); - $temp['cnt']>0 ? $temp['avg'] = $temp['sum']/$temp['cnt'] : $temp['avg']=0; - $temp['biaozhuncha'] = round($this->getVariance($temp['avg'], $cj,true),2); - $temp['avg'] = round($temp['avg'],2); - $temp['youxiu'] = $this->rate($cj,$youxiu); - $temp['jige'] = $this->rate($cj,$jige); - $temp['sifenwei'] = $this->quartile($cj); - return $temp; - } - - // 统计优秀、及格率 public function rate($cj = array(),$fenshuxian) { @@ -201,7 +180,7 @@ class Tongji extends Model * @param Array $list * @param Boolen $isSwatch * @return unknown type - */ + */ public static function getVariance($avg, $list, $isSwatch = FALSE) { $arrayCount = count($list); if($arrayCount == 1 && $isSwatch == TRUE){ diff --git a/application/chengji/view/index/read_add.html b/application/chengji/view/index/read_add.html index 26dbd62a..6887c658 100644 --- a/application/chengji/view/index/read_add.html +++ b/application/chengji/view/index/read_add.html @@ -58,7 +58,6 @@ } return str; }}, - {field: 'update_time', title: '更新时间 ', minWidth:100,sort: true}, {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} ]]; options.url = "{:url('ajaxaddinfo')}"; diff --git a/application/common.php b/application/common.php index ce2dc2d2..445e8b40 100644 --- a/application/common.php +++ b/application/common.php @@ -67,9 +67,6 @@ function nianjiList() $njlist[$nian-3]='四年级'; $njlist[$nian-4]='五年级'; $njlist[$nian-5]='六年级'; - $njlist[$nian-6]='七年级'; - $njlist[$nian-5]='八年级'; - $njlist[$nian-5]='九年级'; return $njlist; } diff --git a/application/kaoshi/model/Kaohao.php b/application/kaoshi/model/Kaohao.php index e36807d8..e505e513 100644 --- a/application/kaoshi/model/Kaohao.php +++ b/application/kaoshi/model/Kaohao.php @@ -166,7 +166,7 @@ class Kaohao extends Base $data[$key]['school'] = $value->cj_school->jiancheng; if($value->cj_student != Null){ $data[$key]['student'] = $value->cj_student->xingming; - $data[$key]['sex'] = $value->cj_student->sex; + $data[$key]['sex'] = $stuinfo->sex; }else{ $stuinfo = $stu::withTrashed() ->where('id',$value->student) diff --git a/application/rongyu/controller/DwRongyu.php b/application/rongyu/controller/DwRongyu.php index cd0a952b..29250be2 100644 --- a/application/rongyu/controller/DwRongyu.php +++ b/application/rongyu/controller/DwRongyu.php @@ -102,7 +102,7 @@ class DwRongyu extends Base public function save() { // 获取表单数据 - $list = request()->only(['url','title','teachers'=>array(),'hjschool','category','fzshijian','fzschool','jiangxiang'],'post'); + $list = request()->only(['url','project','title','teachers'=>array(),'hjschool','category','fzshijian','fzschool','jiangxiang'],'post'); // 实例化验证模型 $validate = new \app\rongyu\validate\DwRongyu; @@ -227,7 +227,7 @@ class DwRongyu extends Base { // 获取学生信息 $list['data'] = dwry::where('id',$id) - ->field('id,title,category,hjschool,fzshijian,fzschool,jiangxiang,url') + ->field('id,title,project,category,hjschool,fzshijian,fzschool,jiangxiang,url') ->with([ 'cyDwry'=>function($query){ $query->field('rongyuid,teacherid') @@ -263,7 +263,7 @@ class DwRongyu extends Base public function update($id) { // 获取表单数据 - $list = request()->only(['title','category','hjschool','fzshijian','fzschool','jiangxiang','teachers'=>array(),'url'],'put'); + $list = request()->only(['title','project','category','hjschool','fzshijian','fzschool','jiangxiang','teachers'=>array(),'url'],'put'); $list['id'] = $id; diff --git a/application/rongyu/view/dw_rongyu/create.html b/application/rongyu/view/dw_rongyu/create.html index 41d7f6c1..49e7c951 100644 --- a/application/rongyu/view/dw_rongyu/create.html +++ b/application/rongyu/view/dw_rongyu/create.html @@ -53,6 +53,15 @@ +
+ +
+ +
+