Beispiel #1
0
 public function submitPaper()
 {
     $fscore = AnswerModel::instance()->saveProblemAnswer($this->userInfo['user_id'], $this->examId, FillBaseModel::FILL_PROBLEM_TYPE, false);
     $inarr['fillsum'] = $fscore;
     StudentService::instance()->submitExamPaper($this->userInfo['user_id'], $this->examId, $inarr);
     $this->checkActionAfterSubmit();
     redirect(U('Home/Question/navigation', array('eid' => $this->examId)));
 }
 public function submitPaper()
 {
     $allscore = ExamService::instance()->getBaseScoreByExamId($this->examId);
     $jright = AnswerModel::instance()->saveProblemAnswer($this->userInfo['user_id'], $this->examId, JudgeBaseModel::JUDGE_PROBLEM_TYPE, false);
     $inarr['judgesum'] = $jright * $allscore['judgescore'];
     StudentService::instance()->submitExamPaper($this->userInfo['user_id'], $this->examId, $inarr);
     $this->checkActionAfterSubmit();
     redirect(U('Home/Question/navigation', array('eid' => $this->examId)));
 }
 public function submitPaper()
 {
     $start_timeC = strftime("%Y-%m-%d %X", strtotime($this->examBase['start_time']));
     $end_timeC = strftime("%Y-%m-%d %X", strtotime($this->examBase['end_time']));
     $allscore = ExamService::instance()->getBaseScoreByExamId($this->examId);
     $inarr['choosesum'] = $this->chooseSumScore == -1 ? 0 : $this->chooseSumScore;
     $inarr['judgesum'] = $this->judgeSumScore == -1 ? 0 : $this->judgeSumScore;
     $inarr['fillsum'] = $this->fillSumScore == -1 ? 0 : $this->fillSumScore;
     $pright = AnswerModel::instance()->getRightProgramCount($this->userInfo['user_id'], $this->examId, $start_timeC, $end_timeC);
     $inarr['programsum'] = round($pright * $allscore['programscore']);
     $inarr['score'] = $inarr['choosesum'] + $inarr['judgesum'] + $inarr['fillsum'] + $inarr['programsum'];
     StudentService::instance()->submitExamPaper($this->userInfo['user_id'], $this->examId, $inarr);
     redirect(U('Home/Index/score'));
 }
 protected function checkActionAfterSubmit()
 {
     $this->initExamUserScore();
     $chooseOk = !($this->chooseCount > 0 && $this->chooseSumScore == -1);
     $judgeOk = !($this->judgeCount > 0 && $this->judgeSumScore == -1);
     $fillOk = !($this->fillCount > 0 && $this->fillSumScore == -1);
     $programOk = !($this->programCount > 0 && $this->programSumScore == -1);
     $needFix = $chooseOk && $judgeOk && $fillOk && $programOk;
     if ($needFix) {
         $inarr['choosesum'] = $this->chooseSumScore == -1 ? 0 : $this->chooseSumScore;
         $inarr['judgesum'] = $this->judgeSumScore == -1 ? 0 : $this->judgeSumScore;
         $inarr['fillsum'] = $this->fillSumScore == -1 ? 0 : $this->fillSumScore;
         $inarr['programsum'] = $this->programSumScore == -1 ? 0 : $this->programSumScore;
         $inarr['score'] = $inarr['choosesum'] + $inarr['judgesum'] + $inarr['fillsum'] + $inarr['programsum'];
         StudentService::instance()->submitExamPaper($this->userInfo['user_id'], $this->examId, $inarr);
         $this->success('恭喜你所有题型已提交完成~', U('Home/Index/score'), 2);
         exit(0);
     }
 }