Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 773 |
Template5IndividualResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
30450.00 | |
0.00% |
0 / 773 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 7 |
|||
processData | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 42 |
|||
renderIndividualMarkCardResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 32 |
|||
processStudentDataForStudentSideRequest | |
0.00% |
0 / 1 |
7656.00 | |
0.00% |
0 / 366 |
|||
processStudentData | |
0.00% |
0 / 1 |
3782.00 | |
0.00% |
0 / 261 |
|||
getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 65 |
<?php | |
// Template Individual Generator For MBCET Colleges | |
namespace com\linways\ec\core\service\RegularIndividualMarkCardGenerator; | |
use com\linways\ec\core\service\StudentMarkListService; | |
use com\linways\ec\core\service\ExamRegistrationService; | |
use com\linways\ec\core\exception\ExamControllerException; | |
use com\linways\base\util\TwigRenderer; | |
use com\linways\core\ams\professional\util\PdfUtil; | |
use com\linways\core\ams\professional\util\CommonUtil; | |
use com\linways\ec\core\service\CommonExamService; | |
use com\linways\ec\core\service\RegularIndividualMarkCardGenerator\RegularIndividualMarkCardResultDataGenerator; | |
use com\linways\core\ams\professional\service\AmsCustomFieldsService; | |
use com\linways\core\ams\professional\constant\AmsCustomFieldsEntities; | |
use com\linways\ec\core\constant\AttendanceStatusConstant; | |
use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants; | |
use phpDocumentor\Reflection\Types\Null_; | |
use com\linways\ec\core\request\SearchExamRegistrationRequest; | |
class Template5IndividualResultGenerator extends RegularIndividualMarkCardResultDataGenerator | |
{ | |
public function __construct(){} | |
/** | |
* get Template Name | |
* @param $request | |
* @param $templateName | |
*/ | |
protected function getTemplateName($request){ | |
$templateName = "template_5"; | |
$examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
if(empty($examRegistrationDetailsArray)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
return $templateName; | |
} | |
/** | |
* Process Student data college base | |
* @param $request | |
*/ | |
protected function processData($request){ | |
$response = new \stdClass; | |
$studentsMarkDetails = []; | |
$request->orderByCurriculum = 1; | |
if ( $request->isStudentSideExamResult == '1' && $request->isMinorOrHonour != '1'){ | |
$studentSideRequest = json_decode(json_encode($request)); | |
$studentSideRequest->examRegistrationId = ''; | |
$studentSideRequest->selectedSemesters[] = $request->academicTermId; | |
$request->excludeMinorHonor = 1; | |
$studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($studentSideRequest); | |
} | |
else{ | |
$studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request); | |
} | |
if(empty($studentsMarkDetails)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
if( $request->isStudentSideExamResult == '1' && !$request->groupId){ | |
$request->groupId = reset($studentsMarkDetails)->studentDetails->batchId; | |
} | |
$examRegistrationData = $this->getExamRegistrationDetailsData($request); | |
if($request->isStudentSideExamResult == '1' ){ | |
$request->examRegistrationId = ''; | |
$responseOfStudentData = $this->processStudentDataForStudentSideRequest($studentsMarkDetails, $request,$examRegistrationData); | |
} | |
else{ | |
$responseOfStudentData = $this->processStudentData($studentsMarkDetails, $request,$examRegistrationData); | |
} | |
$response->studentData = $responseOfStudentData->studentsDetails; | |
$response->totalStudentData = $responseOfStudentData->totalStudentDetails; | |
$response->examRegistrationData = $examRegistrationData ; | |
$response->collegeData = CommonExamService::getInstance()->getCollegeDetails($request); | |
if( $request->displayContentOptions->enableDateFlag == '1'){ | |
if(!$request->displayContentOptions->markListDate ){ | |
$request->displayContentOptions->markListDate = date("d-m-Y"); | |
} | |
else{ | |
$request->displayContentOptions->markListDate = date("d-m-Y", strtotime($request->displayContentOptions->markListDate)); | |
} | |
} | |
$response->displayContentOptions = $request->displayContentOptions; | |
return $response; | |
} | |
/** | |
* Render Program Result | |
* | |
* @param $templateName | |
* @param Object $data | |
* @return Object | |
*/ | |
protected function renderIndividualMarkCardResult($templateName, $data){ | |
if(empty($data)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
else{ | |
$responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/RegularIndividualMarkCards/Template5/$templateName.twig"), [ 'data'=>$data ]); | |
$prtContent = NULL; | |
$responseHtml .= ''; | |
$prtContent .= '<html><head>'; | |
$prtContent .= "<link href='https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400;1,700&display=swap' rel='stylesheet'> | |
<style> | |
</style>"; | |
$prtContent .= '</head><title>Individual Mark Card</title><body>'; | |
$prtContent .= $responseHtml; | |
$prtContent .= '</body></html>'; | |
$totalWidth = 210; | |
$totalHeight = 297; | |
$options = array( | |
'page-width' => $totalWidth."mm", | |
'page-height' => $totalHeight."mm", | |
'dpi' => 96, | |
'margin-top' => "9mm", | |
'margin-left' => "9mm", | |
'margin-right' => "9mm", | |
'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 = $prtContent; | |
$programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
return $programResult; | |
} | |
} | |
/** | |
* processStudentData For Student Side Request | |
* @param $studentsMarkDetails | |
* @param $studentsDetails | |
*/ | |
protected function processStudentDataForStudentSideRequest($studentsMarkDetails, $request = null,$examRegistrationData = null){ | |
$response = new \stdClass; | |
$totalStudentDetails = new \stdClass; | |
$totalStudentDetails->totalStudents = count($studentsMarkDetails); | |
$studentsDetails = []; | |
$serialNos = ["C1" =>"1001", "R1" => "2001", "E1" => "3001", "T1" => "4001", "M1" => "5001"]; | |
// for fetching revaluation data against batch | |
$requestForExamRegistration = new SearchExamRegistrationRequest; | |
$requestForExamRegistration->groupId = $request->groupId; | |
$revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
$academicTermReq = new \stdClass(); | |
$academicTermReq->academicTermId = $request->academicTermId; | |
$academicTermOderNo = reset(CommonExamService::getInstance()->getAcademicTermsDetails($academicTermReq))->orderNo; | |
foreach($studentsMarkDetails as $student){ | |
// fetch student subject mark details | |
$studentSubjectRequest = new \stdClass(); | |
$studentSubjectRequest->studentId = $student->id; | |
$studentSubjectRequest->upToAcademicTermOrderNo = $academicTermOderNo; | |
// minor honour case not considered in individual mark card | |
$studentSubjectRequest->isHonorCourse = false; | |
$studentSubjectRequest->isMinorCourse = false; | |
$studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
// Remove the history of the exam which is not published | |
$publishedExamSubjectHistory = array_filter($studentSubjectHistory,function($value){ | |
return $value->isResultPublished && (strtotime($value->publishingStartDate) <= strtotime(date("Y-m-d H:i"))); | |
}); | |
// for semester CGPA calculation | |
$subjectHistory = []; | |
$totalCredit = 0; | |
$earnedCredit = 0; | |
$earnedCreditPoint = 0; | |
$semesterCgpa = 0; | |
// check for revaluation is published or not when published then consider the revaluation data other wise consider the parent data | |
foreach($publishedExamSubjectHistory as $studentHistory){ | |
if($studentHistory->subjectRevaluationId){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($studentHistory){ | |
return $value->id == $studentHistory->subjectRevaluationId; | |
})); | |
$revaluationBatch = reset($currentRegistration->groups); | |
if ( $revaluationBatch->properties->isResultPublished == 1 && strtotime($revaluationBatch->properties->publishingStartDate) < strtotime(date("Y-m-d H:i"))){ | |
$studentHistory->subjectCreditGradePoint = $studentHistory->subjectCreditGradePoint; | |
$studentHistory->subjectFailedStatus = $studentHistory->subjectFailedStatus; | |
} | |
else{ | |
$studentHistory->subjectCreditGradePoint = $studentHistory->subjectWithoutRevaluationCreditGradePoint; | |
$studentHistory->subjectFailedStatus = $studentHistory->subjectWithoutRevaluationIsFailed; | |
} | |
} | |
} | |
// calculation for cgpa calculations | |
foreach($publishedExamSubjectHistory as $studentHistory){ | |
if($studentHistory->subjectFailedStatus == "FAILED" AND $studentHistory->subjectAttendanceStatus != "ABSENT" && $studentHistory->academicTermId == $request->academicTermId){ | |
$hadSupply = true; | |
} | |
if($subjectHistory[$studentHistory->paperSubjectId]){ | |
if($subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint < $studentHistory->subjectCreditGradePoint){ | |
if($studentHistory->excludeSubjectFromTotal != 1){ | |
if(($studentHistory->isFinalSemSubject === "true" && $studentHistory->isProjectGroupSubject === "true") || $studentHistory->isProjectGroupSubject !== "true"){ | |
$earnedCreditPoint += ($studentHistory->subjectCreditGradePoint - $subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint); | |
} | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
if($studentHistory->subjectFailedStatus == "PASSED" && $request->academicTermId == $studentHistory->academicTermId ){ | |
$earnedCredit += $studentHistory->credit; | |
} | |
} | |
else{ | |
// if($studentHistory->subjectFailedStatus == "PASSED" && $request->academicTermId == $studentHistory->academicTermId ){ | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
// } | |
} | |
} | |
} | |
else{ | |
if($studentHistory->excludeSubjectFromTotal != 1){ | |
if(($studentHistory->isFinalSemSubject === "true" && $studentHistory->isProjectGroupSubject === "true") || $studentHistory->isProjectGroupSubject !== "true"){ | |
if($studentHistory->isFinalSemSubject === "true" && $studentHistory->isProjectGroupSubject === "true"){ | |
$earnedCreditPoint += $studentHistory->creditGradePointProject; | |
$totalCredit += $studentHistory->finalSemProjectCredit; | |
} | |
else{ | |
$earnedCreditPoint += $studentHistory->subjectCreditGradePoint; | |
$totalCredit += $studentHistory->credit; | |
} | |
} | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
if($studentHistory->subjectFailedStatus == "PASSED" && $request->academicTermId == $studentHistory->academicTermId ){ | |
$earnedCredit += $studentHistory->credit; | |
} | |
} | |
else{ | |
// if($studentHistory->subjectFailedStatus == "PASSED" && $request->academicTermId == $studentHistory->academicTermId ){ | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
// } | |
} | |
} | |
} | |
$semesterCgpa = sprintf('%0.2f', round(($earnedCreditPoint/$totalCredit), 2)); | |
$overallFailedHistory = reset(array_filter($subjectHistory,function($value){ | |
return $value->subjectFailedStatus == "FAILED"; | |
})); | |
// check the student attended exam is published or not | |
foreach($student->examRegistrations as $key => $examRegistration){ | |
if( !($examRegistration->batchProperties->isResultPublished ) || (($examRegistration->batchProperties->isResultPublished) && (strtotime($examRegistration->batchProperties->publishingStartDate) > strtotime(date("Y-m-d H:i"))))) { | |
if($examRegistration->examType == 'REGULAR'){ | |
$student->regularNotPublishedExamRegIds[] = $examRegistration->id; | |
} | |
unset($student->examRegistrations[$key]); | |
} | |
else if(($examRegistration->examType) != 'REGULAR'){ | |
if(!empty($examRegistration->blockReasons) || $examRegistration->isResultWithHeld == '1'){ | |
unset($student->examRegistrations[$key]); | |
} | |
} | |
else{ | |
if($examRegistration->isResultWithHeld == '1'){ | |
$student->withHeldExamRegIds[] = $examRegistration->id; | |
unset($student->examRegistrations[$key]); | |
} | |
} | |
} | |
// add semester latest details by exam published with exam month and year | |
$student->examRegistrationIds = array_column($student->examRegistrations,'id'); | |
// handle for special supply case | |
$regularHistory = array_filter(reset($student->academicTerms)->markHistory,function($value){ | |
return $value->historyType == "REGULAR"; | |
}); | |
$supplyHistory = array_filter(reset($student->academicTerms)->markHistory,function($value){ | |
return $value->historyType == "SUPPLEMENTARY"; | |
}); | |
usort($supplyHistory, function($a, $b) { | |
return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))); | |
}); | |
reset($student->academicTerms)->markHistory = array_merge($supplyHistory, $regularHistory); | |
foreach(reset($student->academicTerms)->markHistory as $semesterMarkHistory){ | |
if(in_array($semesterMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
$academicTerm = $semesterMarkHistory; | |
if ( $semesterMarkHistory->hasRevaluationMark ){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($semesterMarkHistory){ | |
return $value->id == $semesterMarkHistory->revaluationId; | |
})); | |
$revaluationBatch = reset($currentRegistration->groups); | |
if ( $revaluationBatch->properties->isResultPublished == 1 && strtotime($revaluationBatch->properties->publishingStartDate) < strtotime(date("Y-m-d H:i"))){ | |
$academicTerm->sgpa = $semesterMarkHistory->sgpa; | |
$academicTerm->failedStatus = $semesterMarkHistory->failedStatus; | |
} | |
else{ | |
$academicTerm->sgpa = $semesterMarkHistory->withoutRevaluationsgpa; | |
$academicTerm->failedStatus = $semesterMarkHistory->withoutRevaluationFailedStatus; | |
} | |
} | |
else{ | |
$academicTerm->sgpa = $semesterMarkHistory->sgpa; | |
$academicTerm->failedStatus = $semesterMarkHistory->failedStatus; | |
} | |
break; | |
} | |
} | |
$studentsDetails[$student->id]->id = $student->id; | |
$studentsDetails[$student->id]->name = $student->studentDetails->name; | |
$studentsDetails[$student->id]->isResultBlocked = $student->isResultBlocked; | |
$studentsDetails[$student->id]->blockingMsg = $student->blockingMsg; | |
$customFields = AmsCustomFieldsService::getInstance()->getAmsCustomFieldValue(AmsCustomFieldsEntities::STUDENT, $student->id, []); | |
if( $customFields ){ | |
$studentsDetails[$student->id]->ktuCode = CommonExamService::getInstance()->getCustomFieldObjectList($customFields)->studentData->KTU_CODE; | |
} | |
$studentsDetails[$student->id]->slNo = ""; | |
$studentsDetails[$student->id]->failedStatus = $academicTerm->failedStatus; | |
$studentsDetails[$student->id]->overallFailedStatus = $overallFailedHistory ? "FAILED" : "PASSED"; | |
$studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
$studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
$studentsDetails[$student->id]->semesterGrade = $academicTerm->grade; | |
$studentsDetails[$student->id]->semesterClass = $academicTerm->class; | |
$studentsDetails[$student->id]->semesterCredit = $academicTerm->credit; | |
$studentsDetails[$student->id]->creditGradePoint = $academicTerm->creditGradePoint; | |
$studentsDetails[$student->id]->passPercentageDisplay = $student->studentDetails->academicYear < 2019 ? 40 : 40; | |
$studentsDetails[$student->id]->passPercentageDisplayMessage = $student->studentDetails->academicYear < 2019 ? "For a pass in each course, 40% mark OR E grade is necessary." : "For a pass in each course ,35% is necessary."; | |
$studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $academicTerm->sgpa); | |
$studentsDetails[$student->id]->semesterCgpa = $academicTerm->failedStatus == 'FAILED' ? '' : $semesterCgpa; | |
$studentsDetails[$student->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
$studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
$studentsDetails[$student->id]->semesterPercentage = round($academicTerm->percentage,2); | |
if($studentsDetails[$student->id]->failedStatus == "PASSED"){ | |
$totalStudentDetails->passStudents ++; | |
} | |
$studentsDetails[$student->id]->myImage = $student->studentDetails->myImage; | |
$semesterNames = CommonExamService::getInstance()->getDifferentSemesterName(reset($student->academicTerms)->name); | |
$studentsDetails[$student->id]->semInSemNumber = $semesterNames->semNumber; | |
$studentsDetails[$student->id]->totalEarnedCredits = $academicTerm->credit; | |
$studentsDetails[$student->id]->semesterCreditGradePoint = $academicTerm->creditGradePoint; | |
$studentsDetails[$student->id]->semesterpassPercentage = $academicTerm->passPercentage; | |
$studentsDetails[$student->id]->semesterTotalMinimumMarks = $student->academicTerms[0]->totalMarks * $student->academicTerms[0]->passPercentage / 100; | |
$studentsDetails[$student->id]->semesterTotalMarks = $student->academicTerms[0]->totalMarks; | |
$studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
$studentsDetails[$student->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($academicTerm->markObtained)); | |
$studentsDetails[$student->id]->semesterExamMonth= $academicTerm->examMonth; | |
$studentsDetails[$student->id]->semesterExamYear = $academicTerm->examYear; | |
$studentsDetails[$student->id]->semesterExamMonthName = ExamRegistrationService::getInstance()->getMonthName($studentsDetails[$student->id]->semesterExamMonth); | |
// fetch student mark list serial number | |
$slNoRequest = new \stdClass; | |
$slNoRequest->studentId = $student->id; | |
$slNoRequest->examRegistrationId = $academicTerm->examRegistrationId; | |
$slNoRequest->checkExistance = true; | |
$slNo = CommonExamService::getInstance()->getStudentExamMarkListSerialNumber($slNoRequest)->markListSerialNo; | |
// fetch latest exam registration details | |
$examDetailsReq = new \stdClass; | |
$examDetailsReq->examRegistrationId = $academicTerm->examRegistrationId; | |
$examDetailsReq->groupId = $request->groupId; | |
$examRegistrationDetails = reset(ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($examDetailsReq)); | |
if ( empty($slNo)) { | |
$batchRequest = new \stdClass; | |
$batchRequest->examRegistrationId = $academicTerm->examRegistrationId; | |
$batchRequest->batchStartYear = $examRegistrationDetails->groups[0]->batchStartYear; | |
$batchRequest->deptId = $examRegistrationDetails->groups[0]->deptID;; | |
$batches = CommonExamService::getInstance()->getExambatchesByRequest($batchRequest); | |
$registeredStudentsInDepartment = []; | |
foreach($batches as $batch){ | |
$batchRequest->groupId = $batch->groupId; | |
$students = CommonExamService::getInstance()->getstudentRegisteredForExam($batchRequest); | |
$registeredStudentsInDepartment = array_merge($registeredStudentsInDepartment,$students); | |
} | |
$registeredStudentsInDepartment = array_values($registeredStudentsInDepartment); | |
$studentId = $student->id; | |
$deptStudentFetched = array_filter($registeredStudentsInDepartment, function ($studentObj) use ($studentId) { | |
return $studentObj->studentId == $studentId; | |
}); | |
$position= current(array_keys($deptStudentFetched)); | |
$slNo = (int)$serialNos[$examRegistrationDetails->groups[0]->departmentSpecialization] + $position; | |
} | |
$studentsDetails[$student->id]->slNo = $slNo; | |
$slNoType = $examRegistrationDetails->type == 'REGULAR' ? "R" : "S"; | |
$studentsDetails[$student->id]->certicifateNo = 'No.CoE/Ex/'.$examRegistrationDetails->examYear.'/'.$examRegistrationDetails->groups[0]->courseTypeName.'/S'.$studentsDetails[$student->id]->semInSemNumber.$slNoType.'/'.$studentsDetails[$student->id]->slNo; | |
$studentsDetails[$student->id]->totalEarnedCredits = Null; | |
foreach($student->academicTerms[0]->subjects as $subject){ | |
$regularHistory = array_filter($subject->subjectMarkHistory,function($value){ | |
return $value->examMarkType == "REGULAR"; | |
}); | |
$supplyHistory = array_filter($subject->subjectMarkHistory,function($value){ | |
return $value->examMarkType == "SUPPLY"; | |
}); | |
usort($supplyHistory, function($a, $b) { | |
return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))); | |
}); | |
$subject->subjectMarkHistory = array_merge($supplyHistory, $regularHistory); | |
$studentsDetails[$student->id]->subjects[$subject->id]->id = $subject->id; | |
if ( $subject->syllabusSubType == "MOOC" && $subject->moocCertificateStatus == "APPROVED" ){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->moocSubjectName ? $subject->moocSubjectName : $subject->name; | |
$studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->moocSubjectCode ? $subject->moocSubjectCode : $subject->code; | |
if( $subject->moocSubjectMonthYear ){ | |
list($subject->latestExamMonth, $subject->latestExamYear) = explode('/', $subject->moocSubjectMonthYear); | |
} | |
} | |
else{ | |
$studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->name; | |
$studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->code; | |
} | |
if ( $subject->syllabusSubType == "MOOC" && $subject->moocCertificateStatus != "APPROVED" ){ | |
$subject->credit = ''; | |
} | |
$passSubjectHistory = array_filter($subject->subjectMarkHistory,function($value) use ($student){ | |
return in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds) && $subjectMarkHistory->resultStatus == "PASSED"; | |
}); | |
foreach($subject->subjectMarkHistory as $subjectMarkHistory){ | |
$subjectMarkHistory->isUpdatedMark = false; | |
if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
if ( $subjectMarkHistory->hasRevaluationMark ){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subjectMarkHistory){ | |
return $value->id == $subjectMarkHistory->revaluationId; | |
})); | |
$revaluationBatch = reset($currentRegistration->groups); | |
if ( $revaluationBatch->properties->isResultPublished == 1 && strtotime($revaluationBatch->properties->publishingStartDate) < strtotime(date("Y-m-d H:i"))){ | |
$subject->grade = $subjectMarkHistory->grade; | |
$subject->isFailed = $subjectMarkHistory->resultStatus; | |
} | |
else{ | |
$subject->grade = $subjectMarkHistory->withoutRevaluationGrade; | |
$subject->externalMark = $subjectMarkHistory->withoutRevaluationMark; | |
$subject->isFailed = $subjectMarkHistory->withoutRevaluationIsFailed == 1 ? 'FAILED' : 'PASSED' ; | |
} | |
} | |
else{ | |
$subject->grade = $subjectMarkHistory->grade; | |
$subject->isFailed = $subjectMarkHistory->resultStatus; | |
$subject->updatedExternalMark = $subject->externalMark; | |
} | |
// this case handle for revaluation passed and next supply have been failed , update with the revaluation mark | |
if(!empty($passSubjectHistory) && $passSubjectHistory[0]->resultStatus == 'PASSED' && $subjectMarkHistory->resultStatus != $passSubjectHistory[0]->resultStatus){ | |
$subject->isAlreadyUpdatedMark = true; | |
$subject->latestExamYear = $subjectMarkHistory->examYear; | |
$subject->latestExamMonth = $subjectMarkHistory->examMonth; | |
$subject->credit = $subject->consolidatedMarkDetails->credit; | |
$subject->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
$subject->internalAttendanceStatus = $subjectMarkHistory->internalAttendanceStatus; | |
$subject->studentInternalAttendanceStatus = $subjectMarkHistory->studentAttendanceStatus; | |
} | |
else{ | |
$subject->isAlreadyUpdatedMark = true; | |
$subject->latestExamYear = $subjectMarkHistory->examYear; | |
$subject->latestExamMonth = $subjectMarkHistory->examMonth; | |
$subject->credit = $subject->consolidatedMarkDetails->credit; | |
$subject->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
$subject->internalAttendanceStatus = $subjectMarkHistory->internalAttendanceStatus; | |
$subject->studentInternalAttendanceStatus = $subjectMarkHistory->studentAttendanceStatus; | |
break; | |
} | |
} | |
} | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamYear = $subject->latestExamYear; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonth = $subject->latestExamMonth; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName = ExamRegistrationService::getInstance()->getMonthName($subject->latestExamMonth); | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->class = $subject->class; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->grade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->percentage = $subject->percentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = $subject->externalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalMaxMark = $subject->totalMarks; | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained = $subject->markObtained; | |
$studentsDetails[$student->id]->subjects[$subject->id]->failedStatus = $subject->isFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->credit = ( $subject->credit || $subject->credit == 0 ) ? sprintf('%0.2f', $subject->credit) : $subject->credit; | |
$studentsDetails[$student->id]->subjects[$subject->id]->creditGradePoint = $subject->creditGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->gradePoint = $subject->gradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalGrade = $subject->internalGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalGrade = $subject->externalGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalGradePoint = $subject->internalGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalGradePoint = $subject->externalGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->wgpa = $subject->wgpa; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isExternalFailed = $subject->isExternalFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
$studentsDetails[$student->id]->subjects[$subject->id]->categoryId = $subject->categoryId; | |
$studentsDetails[$student->id]->subjects[$subject->id]->categoryName = $subject->categoryName; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalPassPercentage = $subject->internalPassPercentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalPassPercentage = $subject->externalPassPercentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->aggregatePassPercentage = $subject->aggregatePassPercentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMinimumMark = $subject->internalMaxMark * $subject->internalPassPercentage / 100; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMinimumMark = $subject->externalMaxMark * $subject->externalPassPercentage / 100; | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalMinimumMark = $subject->totalMarks * $subject->aggregatePassPercentage / 100; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalLetterGrade = $subject->internalLetterGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalLetterGrade = $subject->externalLetterGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->attendanceStatus = $subject->attendanceStatus; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isProjectGroupSubject = $subject->consolidatedMarkDetails->isProjectGroupSubject; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isFinalSemSubject = $subject->consolidatedMarkDetails->isFinalSemSubject; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMontYear = $studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName."-".$studentsDetails[$student->id]->subjects[$subject->id]->latestExamYear; | |
if( $subject->isFailed == "PASSED" ){ | |
$studentsDetails[$student->id]->totalEarnedCredits += $subject->credit; | |
} | |
if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subject->attendanceStatus == 'ABSENT'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'AB'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
else if($subject->attendanceStatus == 'MALPRACTICE'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'MAL'; | |
// $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'MAL'; | |
} | |
else if($subject->isFailed == 'FAILED'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
// if($subject->failedStatus == 'FAILED'){ | |
// $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
// } | |
if($subject->internalAttendanceStatus == AttendanceStatusConstant::ABSENT){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = 'AB'; | |
} | |
if($subject->internalAttendanceStatus == AttendanceStatusConstant::INCOMPLETE){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'I'; | |
} | |
if($subject->attendanceStatus == AttendanceStatusConstant::ABSENT){ | |
if($examRegistrationDetails->groups[0]->courseTypeName == CourseTypeConstants::PG && $subject->classType == "THEORY" && $examRegistrationDetails->groups[0]->batchStartYear >= 2022){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'AB'; | |
} | |
} | |
if($subject->attendanceStatus == AttendanceStatusConstant::INCOMPLETE){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'I'; | |
} | |
if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subject->studentInternalAttendanceStatus == 'FE'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'FE'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->credit = '-'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName = '-'; | |
} | |
} | |
uasort($studentsDetails[$student->id]->subjects, function($a, $b) { | |
return ($a->priority > $b->priority); | |
}); | |
} | |
$totalStudentDetails->passPercentage = round(100 * ( $totalStudentDetails->passStudents / $totalStudentDetails->totalStudents),2); | |
$studentsDetails = array_values($studentsDetails); | |
foreach($studentsDetails as $student){ | |
$student->subjects = array_values($student->subjects); | |
$student->subjectCategories = array_values($student->subjectCategories); | |
} | |
$response->studentsDetails = $studentsDetails; | |
$response->totalStudentDetails = $totalStudentDetails; | |
return $response; | |
} | |
/** | |
* processStudentData | |
* @param $studentsMarkDetails | |
* @param $studentsDetails | |
*/ | |
protected function processStudentData($studentsMarkDetails, $request = null,$examRegistrationData = null){ | |
$response = new \stdClass; | |
$totalStudentDetails = new \stdClass; | |
$totalStudentDetails->totalStudents = count($studentsMarkDetails); | |
$studentsDetails = []; | |
$serialNos = ["C1" =>"1001", "R1" => "2001", "E1" => "3001", "T1" => "4001", "M1" => "5001"]; | |
$batchRequest = new \stdClass; | |
$batchRequest->examRegistrationId = $request->examRegistrationId; | |
$batchRequest->batchStartYear = $examRegistrationData->batchStartYear; | |
$batchRequest->deptId = $examRegistrationData->deptID; | |
$batches = CommonExamService::getInstance()->getExambatchesByRequest($batchRequest); | |
$registeredStudentsInDepartment = []; | |
foreach($batches as $batch){ | |
$batchRequest->groupId = $batch->groupId; | |
$students = CommonExamService::getInstance()->getstudentRegisteredForExam($batchRequest); | |
$registeredStudentsInDepartment = array_merge($registeredStudentsInDepartment,$students); | |
} | |
$registeredStudentsInDepartment = array_values($registeredStudentsInDepartment); | |
foreach($studentsMarkDetails as $student){ | |
$studentsDetails[$student->id]->id = $student->id; | |
$studentsDetails[$student->id]->name = $student->studentDetails->name; | |
$studentsDetails[$student->id]->isResultBlocked = $student->isResultBlocked; | |
$studentsDetails[$student->id]->blockingMsg = $student->blockingMsg; | |
$customFields = AmsCustomFieldsService::getInstance()->getAmsCustomFieldValue(AmsCustomFieldsEntities::STUDENT, $student->id, []); | |
if( $customFields ){ | |
$studentsDetails[$student->id]->ktuCode = CommonExamService::getInstance()->getCustomFieldObjectList($customFields)->studentData->KTU_CODE; | |
} | |
$academicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($request){ | |
return $value->examRegistrationId == $request->examRegistrationId; | |
})); | |
$studentSubjectRequest = new \stdClass(); | |
$studentSubjectRequest->studentId = $student->id; | |
$studentSubjectRequest->examMonthLimit = $examRegistrationData->examMonth;; | |
$studentSubjectRequest->examYearLimit = $examRegistrationData->examYear; | |
$studentSubjectRequest->examRegistrationType = "REGULAR"; | |
$studentSubjectRequest->academicTermId = $examRegistrationData->academicTermId; | |
$studentSubjectRequest->isHonorCourse = $examRegistrationData->isHonorCourse; | |
$studentSubjectRequest->isMinorCourse = $examRegistrationData->isMinorCourse; | |
$studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
if ( !$examRegistrationData->isHonorCourse && !$examRegistrationData->isMinorCourse ){ | |
$studentSubjectRequest = new \stdClass(); | |
$studentSubjectRequest->studentId = $student->id; | |
$studentSubjectRequest->upToAcademicTermOrderNoExceptCurrent = $examRegistrationData->academicOrderNo; | |
$studentSubjectRequest->isHonorCourse = $examRegistrationData->isHonorCourse; | |
$studentSubjectRequest->isMinorCourse = $examRegistrationData->isMinorCourse; | |
$studentSubjectHistory2 = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
$studentSubjectHistory = array_merge($studentSubjectHistory,$studentSubjectHistory2); | |
} | |
$subjectHistory = []; | |
$totalCredit = 0; | |
$earnedCredit = 0; | |
$earnedCreditPoint = 0; | |
$semesterCgpa = 0; | |
$isFailed = 0; | |
$hadSupply = false; | |
foreach($studentSubjectHistory as $studentHistory){ | |
if($subjectHistory[$studentHistory->paperSubjectId]){ | |
if($studentHistory->subjectFailedStatus == "FAILED" AND $studentHistory->subjectAttendanceStatus != "ABSENT" && $studentHistory->academicTermId == $examRegistrationData->academicTermId){ | |
$hadSupply = true; | |
} | |
if($subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint < $studentHistory->subjectCreditGradePoint){ | |
if($studentHistory->excludeSubjectFromTotal != 1){ | |
if(($studentHistory->isFinalSemSubject === "true" && $studentHistory->isProjectGroupSubject === "true") || $studentHistory->isProjectGroupSubject !== "true"){ | |
$earnedCreditPoint += ($studentHistory->subjectCreditGradePoint - $subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint); | |
} | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
if($studentHistory->subjectFailedStatus == "PASSED" && $examRegistrationData->academicTermId == $studentHistory->academicTermId ){ | |
$earnedCredit += $studentHistory->credit; | |
} | |
} | |
else{ | |
// if($studentHistory->subjectFailedStatus == "PASSED" && $examRegistrationData->academicTermId == $studentHistory->academicTermId ){ | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
// } | |
} | |
} | |
} | |
else{ | |
if($studentHistory->excludeSubjectFromTotal != 1){ | |
if(($studentHistory->isFinalSemSubject === "true" && $studentHistory->isProjectGroupSubject === "true") || $studentHistory->isProjectGroupSubject !== "true"){ | |
if($studentHistory->isFinalSemSubject === "true" && $studentHistory->isProjectGroupSubject === "true"){ | |
$earnedCreditPoint += $studentHistory->creditGradePointProject; | |
$totalCredit += $studentHistory->finalSemProjectCredit; | |
} | |
else{ | |
$earnedCreditPoint += $studentHistory->subjectCreditGradePoint; | |
$totalCredit += $studentHistory->credit; | |
} | |
} | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
if($studentHistory->subjectFailedStatus == "PASSED" && $examRegistrationData->academicTermId == $studentHistory->academicTermId ){ | |
$earnedCredit += $studentHistory->credit; | |
} | |
} | |
else{ | |
// if($studentHistory->subjectFailedStatus == "PASSED" && $examRegistrationData->academicTermId == $studentHistory->academicTermId ){ | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
// $earnedCreditForDisplay += $studentHistory->credit; | |
// } | |
} | |
} | |
} | |
$semesterCgpa = sprintf('%0.2f', round(($earnedCreditPoint/$totalCredit), 2)); | |
$overallFailedHistory = reset(array_filter($subjectHistory,function($value){ | |
return $value->subjectFailedStatus == "FAILED"; | |
})); | |
$studentsDetails[$student->id]->slNo = ""; | |
$studentsDetails[$student->id]->failedStatus = $academicTerm->failedStatus; | |
$studentsDetails[$student->id]->overallFailedStatus = $overallFailedHistory ? "FAILED" : "PASSED"; | |
$studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
$studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
$studentsDetails[$student->id]->semesterGrade = $academicTerm->grade; | |
$studentsDetails[$student->id]->semesterClass = $academicTerm->class; | |
$studentsDetails[$student->id]->semesterCredit = $student->academicTerms[0]->credit; | |
$studentsDetails[$student->id]->creditGradePoint = $academicTerm->creditGradePoint; | |
$studentsDetails[$student->id]->passPercentageDisplay = $student->studentDetails->academicYear < 2019 ? 40 : 40; | |
$studentsDetails[$student->id]->passPercentageDisplayMessage = $student->studentDetails->academicYear < 2019 ? "For a pass in each course, 40% mark OR E grade is necessary." : "For a pass in each course ,35% is necessary."; | |
$studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $academicTerm->sgpa); | |
$studentsDetails[$student->id]->semesterCgpa = $academicTerm->failedStatus == 'FAILED' ? '' : $semesterCgpa; | |
$studentsDetails[$student->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
$studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
$studentsDetails[$student->id]->semesterPercentage = round($academicTerm->percentage,2); | |
if($studentsDetails[$student->id]->failedStatus == "PASSED"){ | |
$totalStudentDetails->passStudents ++; | |
} | |
$studentsDetails[$student->id]->myImage = $student->studentDetails->myImage; | |
$studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
$studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
$semesterNames = CommonExamService::getInstance()->getDifferentSemesterName(reset($student->academicTerms)->name); | |
$studentsDetails[$student->id]->semInSemNumber = $semesterNames->semNumber; | |
$studentsDetails[$student->id]->totalEarnedCredits = $student->academicTerms[0]->credit; | |
$studentsDetails[$student->id]->semesterCreditGradePoint = $academicTerm->creditGradePoint; | |
$studentsDetails[$student->id]->semesterpassPercentage = $academicTerm->passPercentage; | |
$studentsDetails[$student->id]->semesterTotalMinimumMarks = $student->academicTerms[0]->totalMarks * $student->academicTerms[0]->passPercentage / 100; | |
$studentsDetails[$student->id]->semesterTotalMarks = $student->academicTerms[0]->totalMarks; | |
$studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
$studentsDetails[$student->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($academicTerm->markObtained)); | |
$studentsDetails[$student->id]->semesterExamMonth= $academicTerm->examMonth; | |
$studentsDetails[$student->id]->semesterExamYear = $academicTerm->examYear; | |
$studentsDetails[$student->id]->semesterExamMonthName = ExamRegistrationService::getInstance()->getMonthName($studentsDetails[$student->id]->semesterExamMonth); | |
$studentsDetails[$student->id]->qrcodeValue = $studentsDetails[$student->id]->registerNo .",".$studentsDetails[$student->id]->semesterExamMonthName."-".$studentsDetails[$student->id]->semesterExamYear.",S".$studentsDetails[$student->id]->semInSemNumber; | |
// $QUICK is the secret key defined in the conf.php | |
// encryption key disabled | |
// $studentsDetails[$student->id]->ciphertext = hash_hmac('sha256', $studentsDetails[$student->id]->qrcodeValue,'123'); | |
// $ciphertext_base64 = base64_encode($studentsDetails[$student->id]->ciphertext); | |
$studentsDetails[$student->id]->qrcodeAllString = $studentsDetails[$student->id]->qrcodeValue; | |
$studentsDetails[$student->id]->myImage = $student->studentDetails->myImage; | |
$studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
$studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
// if( $request->isStudentSideExamResult == '1'){ | |
// $considerSupplimentary = true; | |
// uasort(reset($student->academicTerms)->markHistory, function ($a, $b) { | |
// return date("Y-m", strtotime($a->examYear . "-" . $a->examMonth)) < date("Y-m", strtotime($b->examYear . "-" . $b->examMonth)); | |
// }); | |
// $academicTerm = reset(reset($student->academicTerms)->markHistory); | |
// foreach($student->academicTerms[0]->subjects as $subject){ | |
// // $subject = $subject->consolidatedMarkDetails; | |
// $subject->latestExamYear = $subject->consolidatedMarkDetails->examYear; | |
// $subject->latestExamMonth = $subject->consolidatedMarkDetails->examMonth; | |
// $subject->credit = $subject->consolidatedMarkDetails->credit; | |
// $subject->grade = $subject->consolidatedMarkDetails->grade; | |
// $subject->isFailed = $subject->consolidatedMarkDetails->isFailed ? 'FAILED' : 'PASSED'; | |
// } | |
// $studentsDetails[$student->id]->failedStatus = $academicTerm->failedStatus; | |
// $studentsDetails[$student->id]->semesterGrade = $academicTerm->grade; | |
// $studentsDetails[$student->id]->semesterCredit = $academicTerm->credit; | |
// $studentsDetails[$student->id]->semesterCreditGradePoint = $academicTerm->gradePoint; | |
// // $studentsDetails[$student->id]->semesterSgpa = $academicTerm->sgpa; | |
// $studentsDetails[$student->id]->semesterpassPercentage = $academicTerm->passPercentage; | |
// $studentsDetails[$student->id]->semesterTotalMinimumMarks = $academicTerm->totalMarks * $academicTerm->passPercentage / 100; | |
// $studentsDetails[$student->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
// $studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
// $studentsDetails[$student->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($academicTerm->markObtained)); | |
// $studentsDetails[$student->id]->semesterPercentage = $academicTerm->percentage; | |
// $studentsDetails[$student->id]->semesterClass = $academicTerm->class; | |
// } | |
// else{ | |
// $studentsDetails[$student->id]->failedStatus = $student->academicTerms[0]->isFailed; | |
// $studentsDetails[$student->id]->semesterGrade = $student->academicTerms[0]->grade; | |
// $studentsDetails[$student->id]->semesterCredit = $student->academicTerms[0]->credit; | |
// $studentsDetails[$student->id]->semesterCreditGradePoint = $student->academicTerms[0]->gradePoint; | |
// // $studentsDetails[$student->id]->semesterSgpa = $student->academicTerms[0]->sgpa; | |
// $studentsDetails[$student->id]->semesterpassPercentage = $student->academicTerms[0]->passPercentage; | |
// $studentsDetails[$student->id]->semesterTotalMinimumMarks = $student->academicTerms[0]->totalMarks * $student->academicTerms[0]->passPercentage / 100; | |
// $studentsDetails[$student->id]->semesterTotalMarks = $student->academicTerms[0]->totalMarks; | |
// $studentsDetails[$student->id]->semesterMarkObtained = $student->academicTerms[0]->markObtained; | |
// $studentsDetails[$student->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($student->academicTerms[0]->markObtained)); | |
// $studentsDetails[$student->id]->semesterPercentage = $student->academicTerms[0]->percentage; | |
// $studentsDetails[$student->id]->semesterClass = $student->academicTerms[0]->class; | |
// } | |
if($studentsDetails[$student->id]->failedStatus == "PASSED"){ | |
$totalStudentDetails->passStudents ++; | |
} | |
$slNoRequest = new \stdClass; | |
$slNoRequest->studentId = $student->id; | |
$slNoRequest->examRegistrationId = $request->examRegistrationId; | |
$slNoRequest->checkExistance = true; | |
$slNo = CommonExamService::getInstance()->getStudentExamMarkListSerialNumber($slNoRequest)->markListSerialNo; | |
if ( empty($slNo)) { | |
$studentId = $student->id; | |
$deptStudentFetched = array_filter($registeredStudentsInDepartment, function ($studentObj) use ($studentId) { | |
return $studentObj->studentId == $studentId; | |
}); | |
$position= current(array_keys($deptStudentFetched)); | |
$slNo = (int)$serialNos[$examRegistrationData->departmentSpecialization] + $position; | |
} | |
$studentsDetails[$student->id]->slNo = $slNo; | |
$slNoType = $hadSupply ? "S" : "R"; | |
$studentsDetails[$student->id]->certicifateNo = 'No.CoE/Ex/'.$student->latestExamYear.'/'.$examRegistrationData->courseTypeName.'/S'.$studentsDetails[$student->id]->semInSemNumber.$slNoType.'/'.$studentsDetails[$student->id]->slNo; | |
$studentsDetails[$student->id]->totalEarnedCredits = Null; | |
foreach($student->academicTerms[0]->subjects as $subject){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->id = $subject->id; | |
if ( $subject->syllabusSubType == "MOOC" && $subject->moocCertificateStatus == "APPROVED" ){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->moocSubjectName ? $subject->moocSubjectName : $subject->name; | |
$studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->moocSubjectCode ? $subject->moocSubjectCode : $subject->code; | |
if( $subject->moocSubjectMonthYear ){ | |
list($subject->latestExamMonth, $subject->latestExamYear) = explode('/', $subject->moocSubjectMonthYear); | |
} | |
} | |
else{ | |
$studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->name; | |
$studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->code; | |
} | |
if ( $subject->syllabusSubType == "MOOC" && $subject->moocCertificateStatus != "APPROVED" ){ | |
$subject->credit = ''; | |
} | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamYear = $subject->latestExamYear; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonth = $subject->latestExamMonth; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName = ExamRegistrationService::getInstance()->getMonthName($subject->latestExamMonth); | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->class = $subject->class; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->grade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->percentage = $subject->percentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = $subject->externalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalMaxMark = $subject->totalMarks; | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained = $subject->markObtained; | |
$studentsDetails[$student->id]->subjects[$subject->id]->failedStatus = $subject->isFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->credit = ( $subject->credit || $subject->credit == 0 ) ? sprintf('%0.2f', $subject->credit) : $subject->credit; | |
$studentsDetails[$student->id]->subjects[$subject->id]->creditGradePoint = $subject->creditGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->gradePoint = $subject->gradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalGrade = $subject->internalGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalGrade = $subject->externalGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalGradePoint = $subject->internalGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalGradePoint = $subject->externalGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->wgpa = $subject->wgpa; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isExternalFailed = $subject->isExternalFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
$studentsDetails[$student->id]->subjects[$subject->id]->categoryId = $subject->categoryId; | |
$studentsDetails[$student->id]->subjects[$subject->id]->categoryName = $subject->categoryName; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalPassPercentage = $subject->internalPassPercentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalPassPercentage = $subject->externalPassPercentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->aggregatePassPercentage = $subject->aggregatePassPercentage; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMinimumMark = $subject->internalMaxMark * $subject->internalPassPercentage / 100; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMinimumMark = $subject->externalMaxMark * $subject->externalPassPercentage / 100; | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalMinimumMark = $subject->totalMarks * $subject->aggregatePassPercentage / 100; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalLetterGrade = $subject->internalLetterGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalLetterGrade = $subject->externalLetterGrade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->attendanceStatus = $subject->attendanceStatus; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isProjectGroupSubject = $subject->consolidatedMarkDetails->isProjectGroupSubject; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isFinalSemSubject = $subject->consolidatedMarkDetails->isFinalSemSubject; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMontYear = $studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName."-".$studentsDetails[$student->id]->subjects[$subject->id]->latestExamYear; | |
if( $subject->isFailed == "PASSED" ){ | |
$studentsDetails[$student->id]->totalEarnedCredits += $subject->credit; | |
} | |
if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subject->attendanceStatus == 'ABSENT'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'AB'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
else if($subject->attendanceStatus == 'MALPRACTICE'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'MAL'; | |
// $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'MAL'; | |
} | |
else if($subject->isFailed == 'FAILED'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
// if($subject->failedStatus == 'FAILED'){ | |
// $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
// } | |
if($subject->internalAttendanceStatus == AttendanceStatusConstant::ABSENT){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = 'AB'; | |
} | |
if($subject->internalAttendanceStatus == AttendanceStatusConstant::INCOMPLETE){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'I'; | |
} | |
if($subject->attendanceStatus == AttendanceStatusConstant::ABSENT){ | |
if($examRegistrationData->courseTypeName == CourseTypeConstants::PG && $subject->classType == "THEORY" && $examRegistrationData->batchStartYear >= 2022){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'AB'; | |
} | |
} | |
if($subject->attendanceStatus == AttendanceStatusConstant::INCOMPLETE){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'I'; | |
} | |
if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subject->studentInternalAttendanceStatus == 'FE'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'FE'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->credit = '-'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName = '-'; | |
} | |
} | |
// uasort($studentsDetails[$student->id]->subjects, function($a, $b) { | |
// return ($a->priority > $b->priority); | |
// }); | |
} | |
$totalStudentDetails->passPercentage = round(100 * ( $totalStudentDetails->passStudents / $totalStudentDetails->totalStudents),2); | |
$studentsDetails = array_values($studentsDetails); | |
foreach($studentsDetails as $student){ | |
$student->subjects = array_values($student->subjects); | |
$student->subjectCategories = array_values($student->subjectCategories); | |
} | |
$response->studentsDetails = $studentsDetails; | |
$response->totalStudentDetails = $totalStudentDetails; | |
return $response; | |
} | |
protected function getExamRegistrationDetailsData($request){ | |
$examRegistrationDetails = new \stdClass; | |
$examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
if(empty($examRegistrationDetailsArray)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
$examRegistrationDetails->name = $examRegistrationDetailsArray[0]->name; | |
$examRegistrationDetails->examYear = $examRegistrationDetailsArray[0]->examYear; | |
$examRegistrationDetails->examMonth = $examRegistrationDetailsArray[0]->examMonth; | |
$examRegistrationDetails->examMonthName = $examRegistrationDetailsArray[0]->examMonthName; | |
$examRegistrationDetails->type = $examRegistrationDetailsArray[0]->type; | |
$examRegistrationDetails->groupId = $examRegistrationDetailsArray[0]->groups[0]->groupId; | |
$examRegistrationDetails->groupName = $examRegistrationDetailsArray[0]->groups[0]->groupName; | |
$examRegistrationDetails->courseTypeID = $examRegistrationDetailsArray[0]->groups[0]->courseTypeID; | |
$examRegistrationDetails->courseTypeName = $examRegistrationDetailsArray[0]->groups[0]->courseTypeName; | |
$examRegistrationDetails->departmentDesc = $examRegistrationDetailsArray[0]->groups[0]->departmentDesc; | |
$examRegistrationDetails->departmentSpecialization = $examRegistrationDetailsArray[0]->groups[0]->departmentSpecialization; | |
$examRegistrationDetails->degreeDescription = $examRegistrationDetailsArray[0]->groups[0]->degreeDescription; | |
$examRegistrationDetails->academicTermName = $examRegistrationDetailsArray[0]->groups[0]->academicTermName; | |
$examRegistrationDetails->academicTermYear = $examRegistrationDetailsArray[0]->groups[0]->academicTermYear; | |
$examRegistrationDetails->academicTermYearRoman = strtoupper(CommonUtil::convertNumberToRoman($examRegistrationDetails->academicTermYear)); | |
$examRegistrationDetails->academicTermId = $examRegistrationDetailsArray[0]->groups[0]->academicTermId; | |
$semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($examRegistrationDetails->academicTermName); | |
$examRegistrationDetails->semInRomanLetter = $semesterNames->romanLetter; | |
$examRegistrationDetails->semInFullName = $semesterNames->fullName; | |
$examRegistrationDetails->semInSemNumber = $semesterNames->semNumber; | |
$examRegistrationDetails->batchStartYear = $examRegistrationDetailsArray[0]->groups[0]->batchStartYear; | |
$examRegistrationDetails->deptID = $examRegistrationDetailsArray[0]->groups[0]->deptID; | |
$examRegistrationDetails->deptName = $examRegistrationDetailsArray[0]->groups[0]->deptName; | |
$examRegistrationDetails->degreeName = $examRegistrationDetailsArray[0]->groups[0]->degreeName; | |
$examRegistrationDetails->academicOrderNo = reset($examRegistrationDetailsArray)->groups[0]->academicOrderNo; | |
$examRegistrationDetails->isHonorCourse = reset($examRegistrationDetailsArray)->properties->isHonorCourse == "1" ? true : false; | |
$examRegistrationDetails->isMinorCourse = reset($examRegistrationDetailsArray)->properties->isMinorCourse == "1" ? true : false; | |
if ( $examRegistrationDetails->isHonorCourse || $examRegistrationDetails->isMinorCourse ){ | |
$examRegistrationDetails->isShortCourse = true; | |
} | |
foreach($examRegistrationDetailsArray[0]->groups[0]->subjects as $subject){ | |
$examRegistrationDetails->subjects[$subject->id]->id = $subject->id; | |
$examRegistrationDetails->subjects[$subject->id]->code = $subject->code; | |
$examRegistrationDetails->subjects[$subject->id]->name = $subject->name; | |
$examRegistrationDetails->subjects[$subject->id]->isInternal = 1; | |
$examRegistrationDetails->subjects[$subject->id]->isExternal = 1; | |
$examRegistrationDetails->subjects[$subject->id]->credit = $subject->credit; | |
$examRegistrationDetails->subjects[$subject->id]->id = $subject->id; | |
$examRegistrationDetails->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
$examRegistrationDetails->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
$examRegistrationDetails->subjects[$subject->id]->totalSubjectMark = $subject->totalSubjectMark; | |
if(!$request->hideExternalOrInternalMark){ | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = 4; | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = $examRegistrationDetails->subjects[$subject->id]->isInternal ? $examRegistrationDetails->subjects[$subject->id]->subColSpan + 1 : $examRegistrationDetails->subjects[$subject->id]->subColSpan; | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = $examRegistrationDetails->subjects[$subject->id]->isExternal ? $examRegistrationDetails->subjects[$subject->id]->subColSpan + 1 : $examRegistrationDetails->subjects[$subject->id]->subColSpan; | |
} | |
else{ | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = 1; | |
} | |
} | |
$examRegistrationDetails->totalColSpan = 5; | |
if(!$request->hideExternalOrInternalMark){ | |
$examRegistrationDetails->totalColSpan = 4; | |
} | |
foreach($examRegistrationDetails->subjects as $subject){ | |
$examRegistrationDetails->totalColSpan = $examRegistrationDetails->totalColSpan + $subject->subColSpan; | |
} | |
$examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
return $examRegistrationDetails; | |
} | |
} |