Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 167 |
| ProgramResultService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
72.00 | |
0.00% |
0 / 167 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| getOverAllStudentMarkDetails | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 165 |
|||
| <?php | |
| namespace com\linways\ec\core\service; | |
| use com\linways\ec\core\dto\ExamRegistrationBatch; | |
| use com\linways\ec\core\request\SearchRuleRequest; | |
| use com\linways\ec\core\service\RuleService; | |
| use com\linways\base\util\MakeSingletonTrait; | |
| use com\linways\base\util\SecurityUtils; | |
| use com\linways\ec\core\constant\StatusConstants; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| use com\linways\ec\core\mapper\ProgramResultServiceMapper; | |
| use com\linways\core\ams\professional\service\CommonService; | |
| use com\linways\core\ams\professional\constant\SettingsConstants; | |
| use com\linways\ec\core\service\CommonExamService; | |
| class ProgramResultService extends BaseService | |
| { | |
| use MakeSingletonTrait; | |
| private function __construct() { | |
| $this->mapper = ProgramResultServiceMapper::getInstance()->getMapper(); | |
| } | |
| /** | |
| * get All Registered Students Details | |
| * @param $searchRequest | |
| */ | |
| public function getOverAllStudentMarkDetails($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try | |
| { | |
| $joinQuery = ""; | |
| $subjectOrderBy = CommonService::getInstance()->getSettings(SettingsConstants::EXAM_CONTROLLER, SettingsConstants::SUBJECT_ORDER_TAKEN_BY); | |
| if($subjectOrderBy == "ORDER"){ | |
| $orderBy = " ORDER BY spa.properties->>'$.registerNumber' ASC , CAST(aps.properties ->> '$.orderNo' AS UNSIGNED) ASC , CAST(act.properties ->> '$.orderNo' AS UNSIGNED) ASC"; | |
| } | |
| else{ | |
| $orderBy = " ORDER BY spa.properties->>'$.registerNumber' ASC , CAST(aps.properties ->> '$.priority' AS UNSIGNED) DESC , CAST(act.properties ->> '$.orderNo' AS UNSIGNED) ASC"; | |
| } | |
| $whereQuery = ""; | |
| if(!empty($searchRequest->studentId)) { | |
| $studentIdString = is_array($searchRequest->studentId) ? "'" . implode("','",$searchRequest->studentId) . "'" : "'".$searchRequest->studentId."'"; | |
| $whereQuery .= " AND sa.studentID IN ( $studentIdString )"; | |
| } | |
| if(!empty($searchRequest->groupId)) { | |
| $groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','",$searchRequest->groupId) . "'" : "'".$searchRequest->groupId."'"; | |
| $whereQuery .= " AND g.id IN ( $groupIdString )"; | |
| } | |
| $query = "SELECT DISTINCT | |
| sa.studentID AS id, | |
| sa.studentID AS studentId, | |
| sa.studentName, | |
| spa.properties->>'$.registerNumber' AS regNo, | |
| spa.properties->>'$.rollNumber' AS rollNo, | |
| sa.admissionNo, | |
| sa.myImage, | |
| sa.studentGender, | |
| g.id AS groupId, | |
| g.name AS groupName, | |
| act.id AS academicTermId, | |
| act.name AS academicTermName, | |
| act.properties ->> '$.orderNo' AS academicTermOrderNo, | |
| dept.deptID, | |
| deg.name AS degreeName, | |
| deg.id AS degreeId, | |
| dept.deptName, | |
| ct.courseTypeID, | |
| ct.typeName AS courseTypeName, | |
| g.properties ->> '$.startYear' AS academicYear, | |
| g.properties ->> '$.finalTermId' AS finalTermId, | |
| esmdsem.mark_details ->>'$.sgpa' AS semesterSgpa, | |
| esmdsem.mark_details ->>'$.percentage' AS semesterPercentage, | |
| esmdsem.mark_details ->>'$.grade' AS semesterGrade, | |
| esmdsem.mark_details ->>'$.markObtained' AS semesterMarkObtained, | |
| esmdsem.mark_details ->>'$.class' AS semesterClass, | |
| esmdsem.mark_details ->>'$.totalMarks' AS semesterTotalMarks, | |
| esmdsem.mark_details ->>'$.credit' AS semesterCredit, | |
| esmdsem.mark_details ->>'$.gradePoint' AS semesterGradePoint, | |
| esmdsem.mark_details ->>'$.creditGradePoint' AS semesterCreditGradePoint, | |
| esmdsem.mark_history AS semesterMarkHistory, | |
| esmdsem.mark_details AS semesterMarkDetails, | |
| esmdsem.failed_status AS semesterFailedStatus, | |
| s.code AS subjectCode, | |
| aps.properties ->> '$.syllabusName' AS syllabusName, | |
| aps.properties ->> '$.categoryId' AS subCategoryId, | |
| ap.properties ->> '$.order' AS subjectOrder, | |
| s.name AS subjectName, | |
| aps.id AS academicPaperSubjectId, | |
| esmdsubcon.mark_details ->>'$.markObtained' AS subjectMarkObtained, | |
| esmdsubcon.mark_details ->>'$.isExternalFailed' AS isExternalFailed, | |
| esmdsubcon.mark_details ->>'$.externalGrade' AS subjectExtrenalGrade, | |
| esmdsubcon.mark_details ->>'$.externalGradePoint' AS subjectExternalGradePoint, | |
| esmdsubcon.mark_details ->>'$.wgpa' AS subjectWgpa, | |
| esmdsubcon.mark_details->>'$.attendanceStatus' AS subjectAttendanceStatus, | |
| esmdsubcon.mark_details->>'$.internalAttendanceStatus' AS internalAttendanceStatus, | |
| esmdsubcon.mark_details ->>'$.internalMark' AS internalMark, | |
| esmdsubcon.class AS subjectClass, | |
| esmdsubcon.percentage AS subjectPercentage, | |
| esmdsubcon.grade AS subjectGrade, | |
| esmdsubcon.failed_status AS subjectFailedStatus, | |
| CAST(esmdsubcon.mark_details ->>'$.externalMark' AS DECIMAL(8,2)) AS externalMark, | |
| esmdsubcon.mark_details ->>'$.gradePoint' AS subGradePoint, | |
| esmdsubcon.mark_details ->>'$.gradePoint' AS subjectGradePoint, | |
| esmdsubcon.mark_details ->>'$.creditGradePoint' AS subCreditGradePoint, | |
| esmdsubcon.mark_details ->>'$.creditGradePoint' AS subjectCreditGradePoint, | |
| esmdsubcon.mark_details ->>'$.internalResultStatus' AS subjectInternalResultStatus, | |
| esmdsubcon.mark_details ->>'$.internalAttendance' AS subjectInternalAttendance, | |
| esmdsubcon.mark_details ->>'$.internalGrade' AS subjectInternalGrade, | |
| esmdsubcon.mark_details ->>'$.internalGradePoint' AS subjectInternalGradePoint, | |
| esmdsubcon.mark_details ->>'$.credit' AS subjectCredit, | |
| esmdsubcon.mark_details ->>'$.externalMaxMark' AS externalMaxMark, | |
| esmdsubcon.mark_details ->>'$.internalMaxMark' AS internalMaxMark, | |
| esmdsubcon.mark_details ->>'$.totalMarks' AS subjectTotalMarks, | |
| esmdsubcon.mark_details ->>'$.isExternal' AS isExternal, | |
| esmdsubcon.mark_details ->>'$.isInternal' AS isInternal, | |
| esmdsubcon.mark_details ->>'$.isInternalFailed' AS isInternalFailed, | |
| esmdsubcon.mark_details ->>'$.categoryId' AS subjectCategoryId, | |
| IF(esmdsubcon.mark_details ->>'$.categoryName',esmdsubcon.mark_details ->>'$.categoryName','-') AS subjectCategoryName, | |
| esmdsubcon.mark_details ->>'$.categoryCode' AS subjectCategoryCode, | |
| esmdsubcon.mark_details ->>'$.internalPassPercentage' AS subjectInternalPassPercentage, | |
| esmdsubcon.mark_details ->>'$.externalPassPercentage' AS subjectExternalPassPercentage, | |
| esmdsubcon.mark_details ->>'$.aggregatePassPercentage' AS subjectAggregatePassPercentage, | |
| esmdsubcon.mark_details ->>'$.latestExamYear' AS latestExamYear, | |
| esmdsubcon.mark_details ->>'$.latestExamMonth' AS latestExamMonth, | |
| esmdsubcon.mark_details ->>'$.latestExamType' AS latestExamType, | |
| esmdsubcon.mark_history AS subjectMarkHistory, | |
| esmdsubcon.mark_details AS subjectMarkDetails, | |
| ecmdcourse.mark_details ->>'$.cgpa' AS cgpa, | |
| ecmdcourse.percentage AS overallPercentage, | |
| ecmdcourse.mark_details ->>'$.grade' AS overallGrade, | |
| ecmdcourse.mark_details ->>'$.class' AS overallClass, | |
| ecmdcourse.mark_details ->>'$.markObtained' AS courseObtainedMark, | |
| ecmdcourse.mark_details ->>'$.totalMarks' AS courseTotalMark, | |
| ecmdcourse.mark_details ->>'$.creditxMark' AS courseCreditxMark, | |
| ecmdcourse.mark_details ->>'$.creditGradePoint' AS courseCreditGradePoint, | |
| ecmdcourse.mark_details ->>'$.credit' AS courseTotalCredit, | |
| ecmdcourse.mark_details ->>'$.wgp' AS courseWgp, | |
| ecmdcourse.mark_details ->>'$.wgpa' AS courseWgpa, | |
| ecmdcourse.mark_details ->>'$.gradePoint' AS courseGradePoint, | |
| ecmdcourse.failed_status AS courseFailedStatus | |
| 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 cm_academic_paper_subjects aps ON | |
| eers.cm_academic_paper_subjects_id = aps.id | |
| INNER JOIN cm_academic_paper ap ON | |
| ap.id = aps.cm_academic_paper_id | |
| INNER JOIN v4_ams_subject s ON | |
| aps.ams_subject_id = s.id | |
| INNER JOIN ec_exam_registration eer ON | |
| eer.id = eerb.ec_exam_registration_id | |
| INNER JOIN ec_student_assessment_registration esar ON | |
| esar.am_assessment_id = eers.am_assessment_id AND | |
| esar.ec_exam_registration_type = eer.type AND | |
| CAST(esar.properties ->> '$.registrationStatus' AS CHAR) = 'REGISTERED' AND | |
| CAST(esar.properties ->> '$.feeStatus' AS CHAR) = 'PAID' | |
| INNER JOIN department dept ON | |
| dept.deptID = g.properties ->> '$.departmentId' | |
| INNER JOIN program p ON | |
| p.id = g.properties ->> '$.programId' | |
| INNER JOIN student_program_account spa ON | |
| spa.current_program_id = p.id AND | |
| spa.student_id = esar.student_id AND | |
| spa.properties->>'$.academicStatus' IN ('ACTIVE','COMPLETED') | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = esar.student_id | |
| INNER JOIN degree deg ON | |
| deg.id = p.degree_id | |
| INNER JOIN `course_type` ct ON | |
| ct.courseTypeID = p.course_type_id | |
| INNER JOIN academic_term act ON | |
| act.id = CAST(eerb.properties ->> '$.academicTermId'AS CHAR) AND | |
| act.type = 'SEMESTER' | |
| INNER JOIN ec_consolidated_subject_mark_details esmdsubcon ON | |
| esmdsubcon.groups_id = eerb.groups_id AND esmdsubcon.cm_academic_paper_subjects_id = eers.cm_academic_paper_subjects_id AND esmdsubcon.student_id = sa.studentID | |
| INNER JOIN ec_semester_mark_details esmdsem ON | |
| esmdsem.groups_id = eerb.groups_id AND | |
| esmdsem.academic_term_id = act.id AND | |
| esmdsem.student_id = sa.studentID | |
| INNER JOIN ec_course_mark_details ecmdcourse ON | |
| ecmdcourse.groups_id = eerb.groups_id AND ecmdcourse.student_id = sa.studentID | |
| WHERE 1=1 "; | |
| $studentMarkDetails = $this->executeQueryForList($query.$whereQuery.$orderBy, $this->mapper[ProgramResultServiceMapper::OVER_ALL_MARK_DETAILS]); | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentMarkDetails; | |
| } | |
| } |