Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 431 |
NominalRollService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
6972.00 | |
0.00% |
0 / 431 |
__construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
getNominalRollUIType | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getCurrentExamRegistration | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 32 |
|||
getNominalRollTemplate | |
0.00% |
0 / 1 |
870.00 | |
0.00% |
0 / 150 |
|||
getAllExamRegisteredStudentDetailsForNominalRoll | |
0.00% |
0 / 1 |
380.00 | |
0.00% |
0 / 127 |
|||
getAllSubjectDetailsForNominalRoll | |
0.00% |
0 / 1 |
182.00 | |
0.00% |
0 / 71 |
|||
saveNominalRollRemarks | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 23 |
|||
insertNominalRollRemarks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
<?php | |
namespace com\linways\ec\core\service; | |
use com\linways\base\util\MakeSingletonTrait; | |
use com\linways\ec\core\exception\ExamControllerException; | |
use com\linways\ec\core\service\ExamRegistrationSubjectService; | |
use com\linways\core\ams\professional\service\CommonService; | |
use com\linways\core\ams\professional\constant\SettingsConstants; | |
use com\linways\ec\core\mapper\NominalRollServiceMapper; | |
use com\linways\ec\core\request\SearchExamRegistrationRequest; | |
use com\linways\base\util\TwigRenderer; | |
use com\linways\core\ams\professional\util\PdfUtil; | |
use com\linways\core\ams\professional\constant\examcontroller\ExamRegistrationFeePaymentConstants; | |
use com\linways\ec\core\constant\ShortTermCourseTypeConstants; | |
use com\linways\ec\core\constant\ShortTermCourseModeConstants; | |
class NominalRollService extends BaseService | |
{ | |
use MakeSingletonTrait; | |
private function __construct() { | |
$this->mapper = NominalRollServiceMapper::getInstance()->getMapper(); | |
} | |
/** | |
* get Nominal Roll UI Type | |
* @return $response | |
*/ | |
public function getNominalRollUIType() { | |
try{ | |
$response = new \stdClass; | |
$nominalRollUIType = CommonService::getInstance()->getSettings(SettingsConstants::NOMINAL_ROLL, SettingsConstants::CURRENT_NOMINAL_ROLL_UI_TYPE); | |
if($nominalRollUIType == "TEMPLATE_WITH_MULTIPLE_BATCH"){ | |
$response->nominalRollUIType = "TEMPLATE_WITH_MULTIPLE_BATCH"; | |
} | |
else{ | |
$response->nominalRollUIType = "TEMPLATE_WITH_SINGLE_BATCH"; | |
} | |
} | |
catch (\Exception $e) | |
{ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
return $response; | |
} | |
/** | |
* get Current exam registration | |
* @param $searchRequest | |
* @return $response | |
* @author Krishnajith | |
*/ | |
public function getCurrentExamRegistration($searchRequest) { | |
$searchRequest = $this->realEscapeObject($searchRequest); | |
try{ | |
$examRegistrationDetails = new \stdClass; | |
$response = new \stdClass; | |
if(empty($searchRequest->examRegistrationId)){ | |
throw new ExamControllerException(ExamControllerException::EMPTY_PARAMETERS,"Invailed Request For Nominal Roll"); | |
} | |
$examRegistrations = []; | |
$examRegistrationRequest = new SearchExamRegistrationRequest(); | |
$examRegistrationRequest->id = $searchRequest->examRegistrationId; | |
$examRegistrations = ExamRegistrationService::getInstance()->searchExamRegistration($examRegistrationRequest); | |
if(empty($examRegistrations)){ | |
throw new ExamControllerException(ExamControllerException::ERROR_FETCHING_EXAM_REGISTRATION,"Error Fetching Exam Registration"); | |
} | |
$isEnableNominalRoll = reset($examRegistrations)->properties->isEnableNominalRoll; | |
if($isEnableNominalRoll){ | |
throw new ExamControllerException(ExamControllerException::NOT_ENABLE_NOMINAL_ROLE_FOR_EXAM_REGISTRATION,"Nominal Role Not Enabled By exam Registration"); | |
} | |
$examRegistrationDetails->name = reset($examRegistrations)->name; | |
$examRegistrationDetails->description = reset($examRegistrations)->properties->description == "null" ? null : reset($examRegistrations)->properties->description ; | |
$examRegistrationDetails->examMonth = reset($examRegistrations)->properties->examMonth; | |
if($examRegistrationDetails->examMonth){ | |
$examRegistrationDetails->examMonthName =date("F", mktime(0, 0, 0, $examRegistrationDetails->examMonth, 10)); | |
} | |
$examRegistrationDetails->examYear = reset($examRegistrations)->properties->examYear; | |
$response->examRegistrationDetails = $examRegistrationDetails; | |
return $response; | |
} | |
catch (\Exception $e){ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get Nominal Roll Template | |
* @param $searchRequest | |
* @return $response | |
* @author Krishnajith | |
*/ | |
public function getNominalRollTemplate($searchRequest) { | |
$searchRequest = $this->realEscapeObject($searchRequest); | |
try{ | |
$data = new \stdClass; | |
$request = new \stdClass; | |
$examRegistrationDetails = new \stdClass; | |
$request->examRegistrationId = $searchRequest->examRegistrationId; | |
$request->departmentId = $searchRequest->departmentId; | |
$request->groupId = $searchRequest->groupId; | |
$request->academicTermId = $searchRequest->academicTermId; | |
$request->slotId = $searchRequest->slotId; | |
$request->courseDepartmentId = $searchRequest->courseDepartmentId; | |
$data->showCourseNameWithReport = $searchRequest->showCourseNameWithReport == 'true' ? true : false ; | |
// $subjects = CommonExamService::getInstance()->getAssignedSubjectsInBatch($request); | |
$assignedSubjects = ExamRegistrationSubjectService::getInstance()->getAssignedExamRegistrationSubjectsInBatch($request); | |
$registeredStudents = $this->getAllExamRegisteredStudentDetailsForNominalRoll($request); | |
if(empty( $registeredStudents)){ | |
throw new ExamControllerException(ExamControllerException::NO_STUDENTS_REGISTEDED_OR_PAID,"No Student(s) Found"); | |
} | |
$shortTermCourseTypes = []; | |
$shortTermCourseTypes[] = ShortTermCourseTypeConstants::MINOR; | |
$shortTermCourseTypes[] = ShortTermCourseTypeConstants::MAJOR; | |
$examRegistrationDetails->examRegistrationName = reset($registeredStudents)->examRegistrationName; | |
$examRegistrationDetails->groupName = reset($registeredStudents)->groupName; | |
$examRegistrationDetails->courseType = reset($registeredStudents)->courseType; | |
$examRegistrationDetails->deptName = reset($registeredStudents)->deptName; | |
$examRegistrationDetails->streamName = reset($registeredStudents)->streamName; | |
$examRegistrationDetails->degreeName = reset($registeredStudents)->degreeName; | |
$examRegistrationDetails->academicTermName = reset($registeredStudents)->academicTermName; | |
$examRegistrationDetails->examRegistrationType = reset($registeredStudents)->examRegistrationType; | |
$subjects = []; | |
foreach($assignedSubjects as $currentSubject){ | |
if(empty($subjects[$currentSubject->id])){ | |
$subjects[$currentSubject->id] = $currentSubject; | |
$subjects[$currentSubject->id]->groupNames[$currentSubject->groupId] = $currentSubject->groupName; | |
$subjects[$currentSubject->id]->groups[$currentSubject->groupId]->id = $currentSubject->groupId; | |
$subjects[$currentSubject->id]->groups[$currentSubject->groupId]->name = $currentSubject->groupName; | |
$subjects[$currentSubject->id]->groups[$currentSubject->groupId]->registeredStudents = 0; | |
} | |
else{ | |
$subjects[$currentSubject->id]->groupNames[$currentSubject->groupId] = $currentSubject->groupName; | |
$subjects[$currentSubject->id]->groups[$currentSubject->groupId]->id = $currentSubject->groupId; | |
$subjects[$currentSubject->id]->groups[$currentSubject->groupId]->name = $currentSubject->groupName; | |
$subjects[$currentSubject->id]->groups[$currentSubject->groupId]->registeredStudents = 0; | |
} | |
} | |
foreach($subjects as $currentSubject){ | |
$currentSubject->groupName = implode(',',$currentSubject->groupNames); | |
} | |
$subjects = array_values($subjects); | |
$maxSubjectCount = count((array)$subjects); | |
$subjectChunks = array_chunk($subjects, 20); | |
foreach($registeredStudents as $student){ | |
$semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($student->academicTermName); | |
$student->semInRoman = $semesterNames->romanLetter; | |
$student->subjectDiff = $maxSubjectCount - count( $student->subjects); | |
$student->supplyImproveStatus = ""; | |
$isSupplementary = false; | |
$isImprovement = false; | |
array_walk($student->streams, function($stream) use($student){ | |
$student->streamNames[] = $stream->streamName; | |
}); | |
$student->streamName = implode(" and ",$student->streamNames); | |
foreach($student->subjects as $studentSubject){ | |
$studentSubject->isShowShortTermCourseMode = false; | |
if($studentSubject->studentExamRegistrationStatus == "SUPPLEMENTARY"){ | |
$isSupplementary = true; | |
} | |
elseif($studentSubject->studentExamRegistrationStatus == "IMPROVEMENT"){ | |
$isImprovement = true; | |
} | |
foreach($subjects as $currentSubject){ | |
if($studentSubject->id == $currentSubject->id){ | |
if($student->examRegistrationProperties->isShortTermCourse && in_array($student->examRegistrationProperties->shortTermCourseType, $shortTermCourseTypes) && $studentSubject->studentCourseMode == ShortTermCourseModeConstants::MOOC){ | |
$studentSubject->isShowShortTermCourseMode = true; | |
} | |
elseif($studentSubject->syllabusSubType != 'MOOC'){ | |
$currentSubject->noOfRegisteredStudents ++ ; | |
if(!empty($currentSubject->groups[$student->groupId])){ | |
$currentSubject->groups[$student->groupId]->registeredStudents ++; | |
} | |
} | |
} | |
} | |
} | |
if($isSupplementary && $isImprovement){ | |
$student->supplyImproveStatus = "SUPPLY/IMPROVE"; | |
} | |
elseif($isSupplementary && !$isImprovement){ | |
$student->supplyImproveStatus = "SUPPLEMENTARY"; | |
} | |
elseif(!$isSupplementary && $isImprovement){ | |
$student->supplyImproveStatus = "IMPROVEMENT"; | |
} | |
} | |
$data->subjectSlot = reset(reset($registeredStudents)->subjects)->slot; | |
$data->departmentName = reset($subjects)->deptName; | |
$data->subjectData = $subjects; | |
$data->subjectChunks = $subjectChunks; | |
$data->maxSubjectCount = $maxSubjectCount; | |
$data->studentData = $registeredStudents; | |
$data->currentDate = date('d-M-Y'); | |
$data->examRegistrationData = $examRegistrationDetails; | |
$data->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
$nominalRollUIType = CommonService::getInstance()->getSettings(SettingsConstants::NOMINAL_ROLL, SettingsConstants::CURRENT_NOMINAL_ROLL_UI_TYPE); | |
if($nominalRollUIType == "TEMPLATE_WITH_MULTIPLE_BATCH"){ | |
$templateName = "NominalRoleTemplateWithoutSubjects"; | |
} | |
else if($nominalRollUIType == "TEMPLATE_6") { | |
$templateName = "Template_6"; | |
} | |
else if($nominalRollUIType == "TEMPLATE_16") { | |
// this template for WCCMD Template (this case template to change reg no to roll no) | |
$templateName = "Template_16"; | |
// change order by roll no | |
usort($data->studentData, function ($a, $b) { | |
return $a->rollNo > $b->rollNo; | |
}); | |
} | |
else{ | |
$templateName = "NominalRoleTemplateWithSubjects"; | |
} | |
if($searchRequest->template == 'SUBJECT_SLOT_WISE_REPORT' || $searchRequest->template == 'DEPARTMENT_WISE_REPORT' ){ | |
$data->reportTemplate = $searchRequest->template; | |
$templateName = "NominalRoleTemplateWithSubjectSlot"; | |
} | |
$responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/NominalRollTemplate/$templateName.twig"), [ 'data'=>$data ]); | |
$prtContent = NULL; | |
$prtContent .= '<html><head><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">'; | |
$prtContent .= "<style> | |
.displayOnlyDisplayData { display: none; } | |
</style>"; | |
$prtContent .= '</head><title>Nominal Roll</title><body>'; | |
$prtContent .= $responseHtml; | |
$prtContent .= '</body></html>'; | |
$totalWidth = 297; | |
$totalHeight = 210; | |
$options = array( | |
'page-width' => $totalWidth."mm", | |
'page-height' => $totalHeight."mm", | |
'dpi' => 96, | |
'margin-top' => "9mm", | |
'margin-left' => "1mm", | |
'margin-right' => "1mm", | |
'margin-bottom' => "9mm", | |
// 'binary' => "/usr/local/bin/wkhtmltopdf", // For Mac | |
'user-style-sheet' => realpath(DOCUMENT_ROOT . "/libcommon/bootstrap/css/bootstrap.min.css") | |
); | |
$programResult = new \stdClass; | |
$programResult->dispalyHtmlData = $responseHtml; | |
$programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
return $programResult; | |
} | |
catch (\Exception $e){ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get All Exam Registered Student Details For Nominal Roll | |
* @param $searchRequest | |
* @return $registeredStudentsDetails | |
* @author Krishnajith | |
*/ | |
public function getAllExamRegisteredStudentDetailsForNominalRoll($searchRequest){ | |
$searchRequest = $this->realEscapeObject($searchRequest); | |
try{ | |
$whereQuery = null; | |
$orderBy = " ORDER BY CAST(spa.properties->>'$.registerNumber' AS CHAR) ASC "; | |
$whereQuery = ""; | |
if(!empty($searchRequest->assessmentId)) { | |
$assessmentIdString = is_array($searchRequest->assessmentId) ? "'" . implode("','",$searchRequest->assessmentId) . "'" : "'".$searchRequest->assessmentId."'"; | |
$whereQuery .= " AND aa.id IN ( $assessmentIdString )"; | |
} | |
if(!empty($searchRequest->examDate)) { | |
$whereQuery .= " AND aa.properties_value ->>'$.assessmentDate' = '$searchRequest->examDate'"; | |
} | |
if(!empty($searchRequest->examRegistrationId)) { | |
$examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','",$searchRequest->examRegistrationId) . "'" : "'".$searchRequest->examRegistrationId."'"; | |
$whereQuery .= " AND eer.id IN ( $examRegistrationIdString )"; | |
} | |
if(!empty($searchRequest->groupId)) { | |
$groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','",$searchRequest->groupId) . "'" : "'".$searchRequest->groupId."'"; | |
$whereQuery .= " AND g.id IN ( $groupIdString )"; | |
} | |
if(!empty($searchRequest->departmentId)) { | |
$departmentIdString = is_array($searchRequest->departmentId) ? "'" . implode("','",$searchRequest->departmentId) . "'" : "'".$searchRequest->departmentId."'"; | |
$whereQuery .= " AND dept.deptID IN ( $departmentIdString )"; | |
} | |
if(!empty($searchRequest->academicTermId)) { | |
$academicTermIdString = is_array($searchRequest->academicTermId) ? "'" . implode("','",$searchRequest->academicTermId) . "'" : "'".$searchRequest->academicTermId."'"; | |
$whereQuery .= " AND act.id IN ( $academicTermIdString )"; | |
} | |
if(!empty($searchRequest->subjectId)) { | |
$subjectIdString = is_array($searchRequest->subjectId) ? "'" . implode("','",$searchRequest->subjectId) . "'" : "'".$searchRequest->subjectId."'"; | |
$whereQuery .= " AND s.id IN ( $subjectIdString )"; | |
} | |
if(!empty($searchRequest->slotId)) { | |
$slotIdString = is_array($searchRequest->slotId) ? "'" . implode("','",$searchRequest->slotId) . "'" : "'".$searchRequest->slotId."'"; | |
$whereQuery .= " AND aps.slot_id IN ( $slotIdString )"; | |
} | |
if(!empty($searchRequest->courseDepartmentId)) { | |
$courseDepartmentIdString = is_array($searchRequest->courseDepartmentId) ? "'" . implode("','",$searchRequest->courseDepartmentId) . "'" : "'".$searchRequest->courseDepartmentId."'"; | |
$whereQuery .= " AND s.department_id IN ( $courseDepartmentIdString )"; | |
} | |
$query = "SELECT | |
DISTINCT | |
sa.studentID AS id, | |
sa.studentID AS studentId, | |
sa.studentName, | |
sa.studentGender, | |
sa.category, | |
spa.properties->>'$.rollNumber' AS rollNo, | |
spa.properties->>'$.registerNumber' AS regNo, | |
esar.properties->>'$.registrationType' AS studentExamRegistrationStatus, | |
esar.properties->>'$.syllabusSubType' AS syllabusSubType, | |
esar.properties->>'$.courseMode' AS studentCourseMode, | |
eers.am_assessment_id AS assessmentId, | |
g.id AS groupId, | |
g.name AS groupName, | |
eer.id AS examRegistrationId, | |
eer.name AS examRegistrationName, | |
eer.type AS examRegistrationType, | |
eer.properties AS examRegistrationProperties, | |
aps.id AS academicPaperSubjectId, | |
aps.properties->>'$.externalMaxMark' as externalMaxMark, | |
s.code AS subjectCode, | |
s.name AS subjectName, | |
IF(aps.properties ->> '$.classType' = 'THEORY',1,0) AS isTheory, | |
aps.properties ->> '$.classType' AS classType, | |
s.code AS syllabusName, | |
aa.properties_value ->>'$.assessmentDate' AS assessmentDate, | |
aa.properties_value ->>'$.startTime' AS assessmentStartTime, | |
aa.properties_value ->>'$.endTime' AS assessmentEndTime, | |
act.id AS academicTermId, | |
act.name AS academicTermName, | |
dept.deptID, | |
dept.deptName, | |
dept.departmentDesc, | |
deg.id AS degreeId, | |
deg.name AS degreeName, | |
str.id AS streamId, | |
str.name AS streamName, | |
nrr.remarks as nominalRollRemarks, | |
cclo.name as slot, | |
eqc.qpCode | |
FROM | |
`groups` g | |
INNER JOIN ec_exam_registration_batch eerb ON | |
eerb.groups_id = g.id | |
INNER JOIN ec_exam_registration eer ON | |
eer.id = eerb.ec_exam_registration_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 am_assessment aa ON | |
aa.id = eers.am_assessment_id | |
INNER JOIN v4_ams_subject s ON | |
aps.ams_subject_id = s.id | |
INNER JOIN program p ON | |
p.id = g.properties ->> '$.programId' | |
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 student_program_account spa ON | |
spa.current_program_id = p.id AND | |
spa.student_id = esar.student_id | |
INNER JOIN studentaccount sa ON | |
sa.studentID = spa.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) | |
LEFT JOIN stream str ON | |
JSON_SEARCH( p.stream_id, 'one', str.id) IS NOT NULL | |
INNER JOIN degree deg ON | |
deg.id = p.degree_id | |
LEFT JOIN examQpCodes eqc ON | |
eqc.cm_academic_paper_subjects_id = aps.id AND eqc.ec_exam_registration_id = eer.id | |
LEFT JOIN nominal_roll_remarks nrr ON | |
nrr.studentID = sa.studentID AND nrr.ec_exam_registration_id = eer.id AND nrr.groups_id = g.id AND nrr.academic_term_id = act.id | |
LEFT JOIN cm_common_list_object cclo ON | |
aps.slot_id = cclo.id AND cclo.type = 'SLOT' | |
WHERE 1=1 "; | |
$registeredStudentsDetails = $this->executeQueryForList($query.$whereQuery.$orderBy, $this->mapper[NominalRollServiceMapper::GET_STUDENT_FOR_NOMINAL_ROLL]); | |
} | |
catch (\Exception $e) | |
{ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
return $registeredStudentsDetails; | |
} | |
/** | |
* get All Subject Details For NominalRoll | |
* @param $searchRequest | |
* @return $registeredStudentsDetails | |
* @author Krishnajith | |
*/ | |
public function getAllSubjectDetailsForNominalRoll($searchRequest){ | |
$searchRequest = $this->realEscapeObject($searchRequest); | |
try{ | |
$whereQuery = null; | |
$orderBy = " ORDER BY s.code ASC "; | |
$whereQuery = ""; | |
if(!empty($searchRequest->assessmentId)) { | |
$assessmentIdString = is_array($searchRequest->assessmentId) ? "'" . implode("','",$searchRequest->assessmentId) . "'" : "'".$searchRequest->assessmentId."'"; | |
$whereQuery .= " AND eers.am_assessment_id IN ( $assessmentIdString )"; | |
} | |
if(!empty($searchRequest->examRegistrationId)) { | |
$examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','",$searchRequest->examRegistrationId) . "'" : "'".$searchRequest->examRegistrationId."'"; | |
$whereQuery .= " AND eerb.ec_exam_registration_id IN ( $examRegistrationIdString )"; | |
} | |
if(!empty($searchRequest->groupId)) { | |
$groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','",$searchRequest->groupId) . "'" : "'".$searchRequest->groupId."'"; | |
$whereQuery .= " AND g.id IN ( $groupIdString )"; | |
} | |
if(!empty($searchRequest->departmentId)) { | |
$departmentIdString = is_array($searchRequest->departmentId) ? "'" . implode("','",$searchRequest->departmentId) . "'" : "'".$searchRequest->departmentId."'"; | |
$whereQuery .= " AND dept.deptID IN ( $departmentIdString )"; | |
} | |
if(!empty($searchRequest->academicTermId)) { | |
$academicTermIdString = is_array($searchRequest->academicTermId) ? "'" . implode("','",$searchRequest->academicTermId) . "'" : "'".$searchRequest->academicTermId."'"; | |
$whereQuery .= " AND act.id IN ( $academicTermIdString )"; | |
} | |
$query = "SELECT | |
DISTINCT | |
eers.am_assessment_id AS assessmentId, | |
aps.id AS academicPaperSubjectId, | |
s.code AS subjectCode, | |
s.name AS subjectName, | |
IF(aps.properties ->> '$.classType' = 'THEORY',1,0) AS isTheory, | |
aps.properties ->> '$.syllabusName' AS syllabusName, | |
aa.properties_value ->>'$.assessmentDate' AS assessmentDate, | |
aa.properties_value ->>'$.startTime' AS assessmentStartTime, | |
aa.properties_value ->>'$.endTime' AS assessmentEndTime, | |
eqc.qpCode | |
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 am_assessment aa ON | |
aa.id = eers.am_assessment_id | |
INNER JOIN v4_ams_subject s ON | |
aps.ams_subject_id = s.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 degree deg ON | |
deg.id = p.degree_id | |
LEFT JOIN examQpCodes eqc ON | |
eqc.cm_academic_paper_subjects_id = aps.id AND eqc.ec_exam_registration_id = eerb.ec_exam_registration_id | |
WHERE 1=1 "; | |
$subjectDetails = $this->executeQueryForList($query.$whereQuery.$orderBy, $this->mapper[NominalRollServiceMapper::GET_SUBJECTS_FOR_NOMINAL_ROLL]); | |
foreach($subjectDetails as $subject){ | |
$subject->noOfRegisteredStudents = 0; | |
} | |
} | |
catch (\Exception $e) | |
{ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
return $subjectDetails; | |
} | |
/** | |
* get Current exam registration | |
* @param $searchRequest | |
* @return $response | |
* @author Krishnajith | |
*/ | |
public function saveNominalRollRemarks($searchRequest) { | |
$searchRequest = $this->realEscapeObject($searchRequest); | |
try{ | |
$insertionValues = []; | |
$nominalRollRemarks = $searchRequest->nominalRollRemarks; | |
if(empty($nominalRollRemarks)){ | |
throw new ExamControllerException(ExamControllerException::EMPTY_PARAMETERS,"Invailed Request For Save Nominal Roll Remarks"); | |
} | |
foreach($nominalRollRemarks as $student){ | |
if(empty($student['studentId']) || empty($student['examRegistrationId']) || empty($student['academicTermId']) || empty($student['groupId'])){ | |
throw new ExamControllerException(ExamControllerException::EMPTY_PARAMETERS,"Invailed Request For Save Nominal Roll Remarks"); | |
} | |
else{ | |
$insertionValues[] = " ( '".$student['studentId']."','".$student['examRegistrationId']."','".$student['groupId']."',,'".$student['academicTermId']."' ) "; | |
} | |
} | |
if( !empty ( $insertionValues ) ){ | |
$this->insertNominalRollRemarks($insertionValues); | |
} | |
} | |
catch (\Exception $e){ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* insert Nominal Roll Remarks | |
* @param $insertionValues | |
*/ | |
public function insertNominalRollRemarks($insertionValues){ | |
try { | |
$insert_query = "INSERT INTO nominal_roll_remarks | |
(studentID,mark,ec_exam_registration_id,groups_id,academic_term_id,remarks) | |
VALUES " . implode ( ",", $insertionValues ) . " ON DUPLICATE KEY UPDATE remarks = VALUES(remarks)" ; | |
$this->executeQuery($insert_query); | |
} | |
catch (\Exception $e){ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
} | |
} |