Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 78 |
| StudentMentorSessionFeedbackService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
240.00 | |
0.00% |
0 / 78 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| __clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
| insertStudentMentorSessionFeedback | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
| updateStudentMentorSessionFeedback | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| confirmStudentMentorSessionFeedback | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getMentorSessionListByStudentId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 21 |
|||
| getMentorSessionStudentFeedbackByStudentIdAndSessionNo | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| <?php | |
| namespace com\linways\core\ams\professional\service; | |
| use com\linways\core\ams\professional\exception\ProfessionalException; | |
| use com\linways\core\ams\professional\dto\StudentMentorSessionFeedback; | |
| class StudentMentorSessionFeedbackService extends BaseService | |
| { | |
| // /Condition 1 - Presence of a static member variable | |
| private static $_instance = null; | |
| // /Condition 2 - Locked down the constructor | |
| private function __construct() | |
| {} | |
| // Prevent any oustide instantiation of this class | |
| // /Condition 3 - Prevent any object or instance of that class to be cloned | |
| private function __clone() | |
| {} | |
| // Prevent any copy of this object | |
| // /Condition 4 - Have a single globally accessible static method | |
| public static function getInstance() | |
| { | |
| if (! is_object(self::$_instance)) // or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
| self::$_instance = new self(); | |
| return self::$_instance; | |
| } | |
| /** | |
| * to save feedback by the student | |
| * @param StudentMentorSessionFeedback $feedbackDetails | |
| * @throws ProfessionalException | |
| */ | |
| public function insertStudentMentorSessionFeedback($feedbackDetails) | |
| { | |
| $feedbackDetails->studentId = $this->realEscapeString($feedbackDetails->studentId); | |
| $feedbackDetails->sessionId = $this->realEscapeString($feedbackDetails->sessionId); | |
| $feedbackDetails->sessionNo = $this->realEscapeString($feedbackDetails->sessionNo); | |
| $feedbackDetails->feedback = $this->realEscapeString($feedbackDetails->feedback); | |
| $sql = "INSERT INTO mentor_session_student_feedback (studentID,session_id,session_no,feedback,created_by,created_date,updated_by,updated_date) VALUES ('$feedbackDetails->studentId','$feedbackDetails->sessionId','$feedbackDetails->sessionNo','$feedbackDetails->feedback','$feedbackDetails->studentId',utc_timestamp(),'$feedbackDetails->studentId',utc_timestamp())"; | |
| try { | |
| $studentFeedbackId = $this->executeQueryForObject($sql); | |
| return $studentFeedbackId; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * To update feedback by the student | |
| * @param StudentMentorSessionFeedback $feedbackDetails | |
| * @throws ProfessionalException | |
| */ | |
| public function updateStudentMentorSessionFeedback($feedbackDetails) | |
| { | |
| $feedbackDetails->studentId = $this->realEscapeString($feedbackDetails->studentId); | |
| $feedbackDetails->feedback = $this->realEscapeString($feedbackDetails->feedback); | |
| $feedbackDetails->sessionId = $this->realEscapeString($feedbackDetails->sessionId); | |
| $feedbackDetails->sessionNo = $this->realEscapeString($feedbackDetails->sessionNo); | |
| $sql = "UPDATE mentor_session_student_feedback SET feedback= '$feedbackDetails->feedback', updated_date = utc_timestamp() WHERE studentID = '$feedbackDetails->studentId' AND session_id = '$feedbackDetails->sessionId' AND session_no = '$feedbackDetails->sessionNo' "; | |
| try { | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * To confirm feedback by the student | |
| * @param StudentMentorSessionFeedback $feedbackDetails | |
| * @throws ProfessionalException | |
| */ | |
| public function confirmStudentMentorSessionFeedback($feedbackDetails) | |
| { | |
| $feedbackDetails->studentId = $this->realEscapeString($feedbackDetails->studentId); | |
| $feedbackDetails->isSubmitted = $this->realEscapeString($feedbackDetails->isSubmitted); | |
| $feedbackDetails->sessionId = $this->realEscapeString($feedbackDetails->sessionId); | |
| $feedbackDetails->sessionNo = $this->realEscapeString($feedbackDetails->sessionNo); | |
| $feedbackDetails->feedback = $this->realEscapeString($feedbackDetails->feedback); | |
| $sql = "UPDATE mentor_session_student_feedback SET feedback= '$feedbackDetails->feedback',isSubmitted= '$feedbackDetails->isSubmitted', updated_date = utc_timestamp() WHERE session_no='$feedbackDetails->sessionNo' AND studentID = '$feedbackDetails->studentId' AND session_id = '$feedbackDetails->sessionId'"; | |
| try { | |
| $this->executeQuery($sql); | |
| return true; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * To list mentor sessions | |
| * @param StudentMentorSessionFeedback $feedbackDetails | |
| * @throws ProfessionalException | |
| */ | |
| public function getMentorSessionListByStudentId($request) | |
| { | |
| $request->studentId = $this->realEscapeString($request->studentId); | |
| $request->sbsId = $this->realEscapeString($request->sbsId); | |
| $mentorSessionType = CommonService::getInstance()->getSettings("MENTOR_SESSION","MENTOR_SESSION_ATTENDANCE_TYPE"); | |
| if($mentorSessionType == "TIMETABLE"){ | |
| $sql = "SELECT ms.id,ms.session_name,ms.session_no,a.studentID,ms.hour,ms.date,ms.end_time,if(mssf.isSubmitted is null , 0 ,mssf.isSubmitted) as isSubmitted,mssf.feedback, a.isAbsent ,if( ms.end_time is null, concat(ms.date,' ','11:59 PM'), concat(ms.date,' ',ms.end_time)) as lastDate,ms.session_end_date as sessionEndDate from mentor_session ms INNER JOIN pseudosubjects_sbs psbs ON psbs.pseudosubjectID = ms.psid INNER JOIN attendance a ON a.attendanceDate = ms.date AND a.hour = ms.hour AND psbs.sbsID = a.sbsID LEFT JOIN mentor_session_student_feedback mssf ON ms.id = mssf.session_id and mssf.studentID = a.studentID WHERE psbs.sbsID='$request->sbsId' AND a.studentID='$request->studentId' ORDER BY ms.session_no desc"; | |
| } | |
| else{ | |
| $sql = "SELECT ms.id,ms.session_name,ms.session_no,s.studentID,ms.hour,ms.date,ms.end_time,if(mssf.isSubmitted is null , 0 ,mssf.isSubmitted) as isSubmitted,mssf.feedback, IF(msstf.is_absent is NULL,1,msstf.is_absent) as isAbsent ,if( ms.end_time is null, concat(ms.date,' ','11:59 PM'), concat(ms.date,' ',ms.end_time)) as lastDate,ms.session_end_date as sessionEndDate from mentor_session ms inner join pseudosubjects_students pss on ms.psid = pss.pseudosubjectID | |
| inner join pseudosubjects_sbs psbs on ms.psid = psbs.pseudosubjectID | |
| inner join studentaccount s on s.studentID = pss.studentID | |
| LEFT JOIN mentor_session_student_feedback mssf ON ms.id = mssf.session_id and mssf.studentID = pss.studentID | |
| left join mentor_session_staff_feedback msstf on msstf.session_id=ms.id and msstf.studentID = pss.studentID WHERE psbs.sbsID='$request->sbsId' AND pss.studentID='$request->studentId' ORDER BY ms.session_no desc"; | |
| } | |
| try { | |
| $sessionList = $this->executeQueryForList($sql); | |
| return $sessionList; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| *to check session feedback for a student by the staff is already saved or not | |
| * @param StudentMentorSessionFeedback $feedbackDetails | |
| * @throws ProfessionalException | |
| */ | |
| public function getMentorSessionStudentFeedbackByStudentIdAndSessionNo($feedbackDetails) | |
| { | |
| $feedbackDetails->studentId = $this->realEscapeString($feedbackDetails->studentId); | |
| $feedbackDetails->sessionNo = $this->realEscapeString($feedbackDetails->sessionNo); | |
| $sql = "SELECT id from mentor_session_student_feedback WHERE studentId='$feedbackDetails->studentId' AND session_no = '$feedbackDetails->sessionNo' "; | |
| try { | |
| $feedbackId = $this->executeQueryForObject($sql)->id; | |
| return $feedbackId; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| } |