public function closeStudentExaminationRepprovedSubject(StudentExaminationRepprovedSubject $student_examination_repproved_subject, PropelPDO $con) { if ($student_examination_repproved_subject->getMark() >= $this->getExaminationNote()) { $student_approved_career_subject = new StudentApprovedCareerSubject(); $student_approved_career_subject->setCareerSubject($student_examination_repproved_subject->getExaminationRepprovedSubject()->getCareerSubject()); $student_approved_career_subject->setStudent($student_examination_repproved_subject->getStudent()); $student_approved_career_subject->setSchoolYear($student_examination_repproved_subject->getExaminationRepprovedSubject()->getExaminationRepproved()->getSchoolYear()); if ($student_examination_repproved_subject->getExaminationRepprovedSubject()->getExaminationRepproved()->getExaminationType() == ExaminationRepprovedType::REPPROVED) { //Final average is the average of the course_subject_student and the mark of student_examination_repproved_subject $average = (string) (($student_examination_repproved_subject->getStudentRepprovedCourseSubject()->getCourseSubjectStudent()->getMarksAverage() + $student_examination_repproved_subject->getMark()) / 2); $average = sprintf('%.4s', $average); if ($average < self::MIN_NOTE) { $average = self::MIN_NOTE; } $student_approved_career_subject->setMark($average); } else { //Final calification is the mark of student_examination_repproved_subject $student_approved_career_subject->setMark($student_examination_repproved_subject->getMark()); } $student_repproved_course_subject = $student_examination_repproved_subject->getStudentRepprovedCourseSubject(); $student_repproved_course_subject->setStudentApprovedCareerSubject($student_approved_career_subject); $student_repproved_course_subject->save($con); $career = $student_repproved_course_subject->getCourseSubjectStudent()->getCourseSubject()->getCareerSubjectSchoolYear()->getCareerSchoolYear()->getCareer(); ##se corrobora si la previa es la última y del último año, hay que egresarlo $previous = StudentRepprovedCourseSubjectPeer::countRepprovedForStudentAndCareer($student_repproved_course_subject->getStudent(), $career); if ($student_repproved_course_subject->getStudent()->getCurrentOrLastStudentCareerSchoolYear()->getYear() >= CareerPeer::getMaxYear() && $previous == 0) { $career_student = CareerStudentPeer::retrieveByCareerAndStudent($career->getId(), $student_repproved_course_subject->getStudent()->getId()); $career_student->setStatus(CareerStudentStatus::GRADUATE); //se guarda el school_year en que termino esta carrera $career_student->setGraduationSchoolYearId(SchoolYearPeer::retrieveCurrent()->getId()); $career_student->save($con); //se guarda el estado en el student_career_school_year $scsy = $student_repproved_course_subject->getCourseSubjectStudent()->getStudent()->getCurrentOrLastStudentCareerSchoolYear(); $scsy->setStatus(StudentCareerSchoolYearStatus::APPROVED); $scsy->save(); } ##se agrega el campo en student_disapproved_course_subject a el link del resultado final $student_repproved_course_subject->getCourseSubjectStudent()->getCourseResult()->setStudentApprovedCareerSubject($student_approved_career_subject)->save($con); $student_approved_career_subject->save($con); } }
/** * If the student approves the previous, then it creates a student_approved_career_subject for this student * * @param StudentExaminationRepprovedSubject $student_examination_repproved_subject * @param PropelPDO $con */ public function closeStudentExaminationRepprovedSubject(StudentExaminationRepprovedSubject $student_examination_repproved_subject, PropelPDO $con) { if ($student_examination_repproved_subject->getMark() >= self::EXAMINATION_NOTE) { $student_approved_career_subject = new StudentApprovedCareerSubject(); $student_approved_career_subject->setCareerSubject($student_examination_repproved_subject->getExaminationRepprovedSubject()->getCareerSubject()); $student_approved_career_subject->setStudent($student_examination_repproved_subject->getStudent()); $student_approved_career_subject->setSchoolYear($student_examination_repproved_subject->getExaminationRepprovedSubject()->getExaminationRepproved()->getSchoolYear()); //Final average is directly student_examination_repproved_subject mark $mark = (string) $student_examination_repproved_subject->getMark(); $mark = sprintf('%.4s', $mark); if ($mark < self::MIN_NOTE) { $mark = self::MIN_NOTE; } $student_approved_career_subject->setMark($mark); $student_repproved_course_subject = $student_examination_repproved_subject->getStudentRepprovedCourseSubject(); $student_repproved_course_subject->setStudentApprovedCareerSubject($student_approved_career_subject); $student_repproved_course_subject->save($con); $student_repproved_course_subject->getCourseSubjectStudent()->getCourseResult()->setStudentApprovedCareerSubject($student_approved_career_subject)->save($con); $student_approved_career_subject->save($con); } }
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); } } } }
public function closeCourseSubjectStudent($result, PropelPDO $con = null, $course_subject_student) { if ($result instanceof StudentApprovedCourseSubject) { $student_approved_career_subject = StudentApprovedCareerSubjectPeer::retrieveByCourseSubjectStudent($course_subject_student); if (is_null($student_approved_career_subject)) { $student_approved_career_subject = new StudentApprovedCareerSubject(); $student_approved_career_subject->setCareerSubject($result->getCourseSubject($con)->getCareerSubject($con)); $student_approved_career_subject->setStudent($result->getStudent($con)); $student_approved_career_subject->setSchoolYear($result->getSchoolYear($con)); $student_approved_career_subject->setMark($result->getMark()); $result->setStudentApprovedCareerSubject($student_approved_career_subject); /* para el caso de que se aprueba por mesa de examen, se debe asociar el student_approved_career_subject * con el student_disapproved_course_subject */ $disapproved = StudentDisapprovedCourseSubjectPeer::retrieveByStudentApprovedCourseSubject($result, $con); if (!is_null($disapproved)) { $disapproved->setStudentApprovedCareerSubject($student_approved_career_subject); $disapproved->save($con); } $student_approved_career_subject->save($con); $result->save($con); } } else { $this->createCourseSubjectStudentExamination($result->getCourseSubjectStudent(null, $con), $con); } }
public function pathwayClose(PropelPDO $con) { foreach ($this->getCourseSubjectStudentPathways() as $course_subject_student_pathway) { $evaluator_instance = SchoolBehaviourFactory::getEvaluatorInstance(); if ($course_subject_student_pathway->getMark() >= $evaluator_instance->getPathwayPromotionNote()) { $original_course_subject_student = $course_subject_student_pathway->getRelatedCourseSubjectStudent(); //$final_mark = $course_subject_student_pathway->getMark(); $course_marks_avg = SchoolBehaviourFactory::getEvaluatorInstance()->getMarksAverage($original_course_subject_student, $con); $final_mark = bcdiv($course_subject_student_pathway->getMark() + $course_marks_avg, 2, 2); $sacs = new StudentApprovedCareerSubject(); $sacs->setCareerSubject($this->getCareerSubjectSchoolYear()->getCareerSubject()); $sacs->setMark($final_mark); $sacs->setStudent($course_subject_student_pathway->getStudent()); $sacs->setSchoolYear($this->getCourse()->getSchoolYear()); $original_course_subject_student->getCourseResult()->setStudentApprovedCareerSubject($sacs); $original_course_subject_student->save($con); $srcs = StudentRepprovedCourseSubjectPeer::retrieveByCourseSubjectStudent($original_course_subject_student); if (is_null($srcs)) { $srcs = new StudentRepprovedCourseSubject(); $srcs->setCourseSubjectStudent($original_course_subject_student); } $srcs->setStudentApprovedCareerSubject($sacs); $srcs->save($con); $sers = StudentExaminationRepprovedSubjectPeer::retrieveByStudentRepprovedCourseSubject($srcs); // TODO: pongo en blanco la referencia a una mesa de previa?? if (is_null($sers)) { $sers = new StudentExaminationRepprovedSubject(); $sers->setStudentRepprovedCourseSubject($srcs); } $sers->setMark($course_subject_student_pathway->getMark()); $sers->setExaminationRepprovedSubject(null); $sers->save($con); } } }