public function closeCourseSubjectStudentExamination(CourseSubjectStudentExamination $course_subject_student_examination, PropelPDO $con = null)
 {
     $con = is_null($con) ? Propel::getConnection() : $con;
     $course_subject_student = $course_subject_student_examination->getCourseSubjectStudent();
     // si aprueba la mesa de examen
     if ($course_subject_student_examination->getMark() >= 6) {
         // se crea el approved course subject
         $sacs = StudentApprovedCourseSubjectPeer::retrieveForCourseSujectStudent($course_subject_student_examination->getCourseSubjectStudent());
         if (is_null($sacs)) {
             $result = new StudentApprovedCourseSubject();
             $result->setCourseSubjectId($course_subject_student->getCourseSubjectId());
             $result->setStudentId($course_subject_student->getStudentId());
             $result->setSchoolYearId($course_subject_student_examination->getExaminationSubject()->getExamination()->getSchoolYearId());
             $average = (string) (($course_subject_student->getMarksAverage() + $course_subject_student_examination->getMark()) / 2);
             $average = sprintf('%.4s', $average);
             // se guarda la NOTA FINAL de la materia
             if ($course_subject_student->getCourseSubject()->getCareerSubjectSchoolYearId() == $this->getCurrentHistoriaDelArte()->getId()) {
                 $average = $course_subject_student_examination->getMark();
             }
             $result->setMark($average);
             $result->save($con);
             $this->closeCourseSubjectStudent($result, $con, $course_subject_student);
         }
     } else {
         // TODO: arreglar esto: pedir a la configuración
         // Pasa de diciembre a febrero (se copia el course_subject_student_examination con examination_number + 1)
         $student_repproved_course_subject = StudentRepprovedCourseSubjectPeer::retrieveCourseSubjectStudent($course_subject_student);
         if (is_null($student_repproved_course_subject)) {
             // se crea una previa
             $student_repproved_course_subject = new StudentRepprovedCourseSubject();
             $student_repproved_course_subject->setCourseSubjectStudentId($course_subject_student->getId());
             $student_repproved_course_subject->save($con);
         }
     }
 }
コード例 #2
0
 public function closeCourseSubjectStudentExamination(CourseSubjectStudentExamination $course_subject_student_examination, PropelPDO $con = null)
 {
     $con = is_null($con) ? Propel::getConnection() : $con;
     $course_subject_student = $course_subject_student_examination->getCourseSubjectStudent();
     // si aprueba la mesa de examen
     if ($course_subject_student_examination->getMark() >= self::EXAMINATION_NOTE) {
         $result = StudentApprovedCareerSubjectPeer::retrieveOrCreateByCareerSubjectAndStudent($course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getCareerSubject()->getId(), $course_subject_student->getStudent()->getId());
         $result->setCareerSubject($course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getCareerSubject());
         $result->setStudent($course_subject_student->getStudent());
         $result->setSchoolYear($course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getSchoolYear());
         if (in_array($course_subject_student->getCourseSubject()->getSubject()->getId(), $this->_introduccion)) {
             $average = (string) $course_subject_student_examination->getMark();
         } else {
             $average = (string) (($course_subject_student->getMarksAverage() + $course_subject_student_examination->getMark()) / 2);
         }
         $average = sprintf('%.4s', $average);
         // se guarda la NOTA FINAL de la materia
         if ($this->getCurrentHistoriaDelArte() && $course_subject_student->getCourseSubject()->getCareerSubjectSchoolYearId() == $this->getCurrentHistoriaDelArte()->getId()) {
             $average = $course_subject_student_examination->getMark();
         }
         if ($average < 4) {
             $average = 4;
         }
         $result->setMark($average);
         ##se agrega en la tupla student_disapproved_course_subject el link a al resultado final
         $student_disapproved_course_subject = $course_subject_student->getCourseResult();
         $student_disapproved_course_subject->setStudentApprovedCareerSubject($result);
         $student_disapproved_course_subject->save($con);
         $result->save($con);
         //Se busca si había una previa creada para esta materia, se debe eliminar
         if ($student_repproved_course_subject = StudentRepprovedCourseSubjectPeer::retrieveByCourseSubjectStudent($course_subject_student)) {
             $student_repproved_course_subject->delete($con);
         }
     } else {
         // TODO: arreglar esto: pedir a la configuración
         // Pasa de diciembre a febrero (se copia el course_subject_student_examination con examination_number + 1)
         if ($course_subject_student_examination->getExaminationNumber() < count($this->_examination_number)) {
             $new_course_subject_student_examination = $course_subject_student_examination->copy();
             $new_course_subject_student_examination->setExaminationNumber($course_subject_student_examination->getExaminationNumber() + 1);
             $new_course_subject_student_examination->setMark(null);
             $new_course_subject_student_examination->setExaminationSubjectId(null);
             $new_course_subject_student_examination->setIsAbsent(false);
             $new_course_subject_student_examination->save($con);
         } else {
             // se crea una previa
             $student_repproved_course_subject = StudentRepprovedCourseSubjectPeer::retrieveByCourseSubjectStudent($course_subject_student);
             if (is_null($student_repproved_course_subject)) {
                 $student_repproved_course_subject = new StudentRepprovedCourseSubject();
             }
             $student_repproved_course_subject->setCourseSubjectStudentId($course_subject_student->getId());
             $student_repproved_course_subject->save($con);
         }
     }
 }
コード例 #3
0
 public function closeCourseSubjectStudentExamination(CourseSubjectStudentExamination $course_subject_student_examination, PropelPDO $con = null)
 {
     $con = is_null($con) ? Propel::getConnection() : $con;
     $course_subject_student = $course_subject_student_examination->getCourseSubjectStudent();
     // si aprueba la mesa de examen
     if ($course_subject_student_examination->getMark() >= $this->getExaminationNote()) {
         $result = StudentApprovedCareerSubjectPeer::retrieveByCourseSubjectStudent($course_subject_student, $course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getSchoolYear());
         if (is_null($result)) {
             $result = new StudentApprovedCareerSubject();
             $result->setCareerSubject($course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getCareerSubject());
             $result->setStudent($course_subject_student->getStudent());
             $result->setSchoolYear($course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getSchoolYear());
         }
         $examination_subject = $course_subject_student_examination->getExaminationSubject();
         // IF is null, is because the course_subject_student_examination has been created editing student history
         $school_year = is_null($examination_subject) ? $course_subject_student->getCourseSubject()->getCareerSubjectSchoolYear()->getSchoolYear() : $examination_subject->getExamination()->getSchoolYear();
         $result->setSchoolYearId($school_year->getId());
         $average = $this->getAverage($course_subject_student, $course_subject_student_examination);
         $average = sprintf('%.4s', $average);
         if ($average < 4) {
             $average = 4;
         }
         // se guarda la NOTA FINAL de la materia
         if ($course_subject_student_examination->getExaminationNumber() == self::FEBRUARY) {
             $this->setFebruaryApprovedResult($result, $average, $course_subject_student_examination->getMark());
         } else {
             $result->setMark($average);
         }
         ##se agrega en la tupla student_disapproved_course_subject el link a al resultado final
         $course_subject_student->getCourseResult()->setStudentApprovedCareerSubject($result)->save($con);
         $result->save($con);
         // verifica si hay creada una tupla de previa de esta materia que no corresponde porque el alumno aprobo en mesas regulares.
         // Si la encuentra la borra ya que no corresponde que exista
         $srcs = StudentRepprovedCourseSubjectPeer::retrieveByCourseSubjectStudent($course_subject_student);
         if ($srcs && is_null($srcs->getStudentApprovedCareerSubject())) {
             $srcs->delete($con);
         }
     } else {
         // TODO: arreglar esto: pedir a la configuración
         // Pasa de diciembre a febrero (se copia el course_subject_student_examination con examination_number + 1)
         if ($course_subject_student_examination->getExaminationNumber() < count($this->_examination_number)) {
             $this->nextCourseSubjectStudentExamination($course_subject_student_examination, $con);
         } else {
             // se crea una previa
             $srcs = StudentRepprovedCourseSubjectPeer::retrieveByCourseSubjectStudent($course_subject_student);
             if (!$srcs && is_null($srcs->getStudentApprovedCareerSubject())) {
                 $student_repproved_course_subject = new StudentRepprovedCourseSubject();
                 $student_repproved_course_subject->setCourseSubjectStudentId($course_subject_student->getId());
                 $student_repproved_course_subject->save($con);
             }
         }
     }
 }