Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 124 |
| BarcodeGenerationService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
272.00 | |
0.00% |
0 / 124 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| generateBarcodeBatchWise | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
| getAllBarcodeStudentData | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 20 |
|||
| getRegisteredStudentDetailsWithFalseNumber | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 89 |
|||
| <?php | |
| namespace com\linways\ec\core\service; | |
| use com\linways\base\util\MakeSingletonTrait; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| use com\linways\core\ams\professional\service\CommonService; | |
| use com\linways\ec\core\service\BarcodeGenerator\BarcodeGenerator; | |
| use com\linways\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\mapper\BarcodeGenerationServiceMapper; | |
| use com\linways\core\ams\professional\service\StudentService; | |
| class BarcodeGenerationService extends BaseService | |
| { | |
| use MakeSingletonTrait; | |
| private function __construct() { | |
| $this->mapper = BarcodeGenerationServiceMapper::getInstance()->getMapper(); | |
| } | |
| /** | |
| * get barCode | |
| * @param $searchRequest | |
| * @return $programResult | |
| * @author Krishnajith | |
| */ | |
| public function generateBarcodeBatchWise($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $request = new \stdClass; | |
| $request->groupId = $searchRequest->groupId; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->academicPaperSubjectId = $searchRequest->academicPaperSubjectId; | |
| $programResult = BarcodeGenerator::getInstance()->getBarcodeResultData($request); | |
| return $programResult; | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get All Hall Tickets Student Data | |
| * @param $searchRequest | |
| * @return $studentDetails | |
| * @author Krishnajith | |
| */ | |
| public function getAllBarcodeStudentData($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $request = new \stdClass; | |
| $request->groupId = $searchRequest->groupId; | |
| $request->academicPaperSubjectId = $searchRequest->academicPaperSubjectId; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->groupId = $searchRequest->groupId; | |
| $studentDetails = $this->getRegisteredStudentDetailsWithFalseNumber($request); | |
| if(empty($studentDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Students Found"); | |
| } | |
| foreach($studentDetails as $student){ | |
| $student->studentImage = StudentService::getInstance()->getStudentProfilePic($student->id)->docpath; | |
| } | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentDetails; | |
| } | |
| /** | |
| * get False Number Generated Student Details | |
| * @author Krishnajith | |
| * @param $searchRequest | |
| * @throws ExamControllerException | |
| */ | |
| public function getRegisteredStudentDetailsWithFalseNumber($searchRequest){ | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $orderBy = " ORDER BY spa.properties->>'$.registerNumber' ASC , s.name ASC"; | |
| $whereQuery = ""; | |
| if(!empty($searchRequest->groupId)) { | |
| $groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','",$searchRequest->groupId) . "'" : "'".$searchRequest->groupId."'"; | |
| $whereQuery .= " AND g.id IN ( $groupIdString )"; | |
| } | |
| if(!empty($searchRequest->academicPaperSubjectId)) { | |
| $academicPaperSubjectIdString = is_array($searchRequest->academicPaperSubjectId) ? "'" . implode("','",$searchRequest->academicPaperSubjectId) . "'" : "'".$searchRequest->academicPaperSubjectId."'"; | |
| $whereQuery .= " AND aps.id IN ( $academicPaperSubjectIdString )"; | |
| } | |
| if(!empty($searchRequest->examRegistrationId)) { | |
| $examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','",$searchRequest->examRegistrationId) . "'" : "'".$searchRequest->examRegistrationId."'"; | |
| $whereQuery .= " AND eerb.ec_exam_registration_id IN ( $examRegistrationIdString )"; | |
| } | |
| if($searchRequest->isAvoidPracticalSubFromFalseNumber) { | |
| $whereQuery .= " AND aps.properties ->> '$.classType' = 'THEORY'"; | |
| } | |
| $query = "SELECT | |
| sa.studentID AS id, | |
| esar.properties ->> '$.falseNo' AS falseNo, | |
| esar.properties ->> '$.alphaNumericCode' AS alphaNumericCode, | |
| IF(esar.properties ->> '$.falseNo' IS NOT NULL,1,0) AS isFalseNoGenerated, | |
| aa.id AS assessmentId, | |
| sa.studentID AS studentId, | |
| sa.studentName, | |
| spa.properties->>'$.registerNumber' as regNo, | |
| spa.properties->>'$.rollNumber' as rollNo, | |
| sa.admissionNo, | |
| act.id AS academicTermId, | |
| act.name AS academicTermName, | |
| dept.deptID AS deptId, | |
| dept.deptName AS deptName, | |
| dept.departmentSpecialization AS departmentCode, | |
| ct.courseTypeID AS courseTypeId, | |
| ct.typeName AS courseTypeName, | |
| ct.course_Type AS courseType, | |
| eer.type AS examType, | |
| g.id AS groupId, | |
| g.name AS groupName, | |
| aps.id AS academicPaperSubjectId, | |
| s.code AS subjectCode, | |
| aps.properties ->> '$.syllabusName' AS syllabusName, | |
| s.name AS subjectName, | |
| IF(aps.properties ->> '$.classType' = 'THEORY',1,0) AS isTheory, | |
| esar.properties AS assessmentProperties, | |
| aa.properties_value ->>'$.startTime' AS assessmentStartTime, | |
| aa.properties_value ->>'$.endTime' AS assessmentEndTime, | |
| DATE_FORMAT(aa.properties_value ->>'$.assessmentDate','%d-%m-%Y') AS assessmentDate | |
| FROM | |
| `groups` g | |
| INNER JOIN ec_exam_registration_batch eerb ON | |
| eerb.groups_id = g.id | |
| INNER JOIN ec_exam_registration_subject eers ON | |
| eers.ec_exam_registration_batch_id = eerb.id | |
| INNER JOIN ec_exam_registration eer ON | |
| eer.id = eerb.ec_exam_registration_id | |
| INNER JOIN am_assessment aa ON | |
| aa.id = eers.am_assessment_id | |
| INNER JOIN cm_academic_paper_subjects aps ON | |
| eers.cm_academic_paper_subjects_id = aps.id | |
| INNER JOIN v4_ams_subject s ON | |
| aps.ams_subject_id = s.id | |
| INNER JOIN ec_student_assessment_registration esar ON | |
| esar.am_assessment_id = eers.am_assessment_id AND CAST(esar.properties ->> '$.registrationStatus' AS CHAR) = 'REGISTERED' AND CAST(esar.properties ->> '$.feeStatus' AS CHAR) = 'PAID' AND esar.ec_exam_registration_type = eer.type | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = esar.student_id | |
| INNER JOIN department dept ON | |
| dept.deptID = g.properties ->> '$.departmentId' | |
| INNER JOIN academic_term act ON | |
| act.id = CAST(eerb.properties ->> '$.academicTermId'AS CHAR) | |
| INNER JOIN program p ON | |
| p.id = g.properties ->> '$.programId' | |
| INNER JOIN student_program_account spa ON | |
| spa.student_id = esar.student_id AND | |
| spa.current_program_id = p.id | |
| INNER JOIN `course_type` ct ON | |
| ct.courseTypeID = p.course_type_id | |
| WHERE | |
| aa.properties_value ->>'$.assessmentDate' IS NOT NULL AND (CAST(esar.properties ->> '$.syllabusSubType' AS CHAR) != 'MOOC' OR esar.properties ->> '$.syllabusSubType' IS NULL)"; | |
| $falseNumberGeneratedStudents = $this->executeQueryForList($query.$whereQuery.$orderBy, $this->mapper[BarcodeGenerationServiceMapper::GET_STUDENT_DETAILS]); | |
| } | |
| catch(\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return($falseNumberGeneratedStudents); | |
| } | |
| } |