Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 336
Template21IndividualResultGenerator
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 5
2256.00
0.00% covered (danger)
0.00%
0 / 336
 __construct
n/a
0 / 0
1
n/a
0 / 0
 getTemplateName
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 7
 processData
0.00% covered (danger)
0.00%
0 / 1
20.00
0.00% covered (danger)
0.00%
0 / 23
 renderIndividualMarkCardResult
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 32
 processStudentData
0.00% covered (danger)
0.00%
0 / 1
870.00
0.00% covered (danger)
0.00%
0 / 213
 getExamRegistrationDetailsData
0.00% covered (danger)
0.00%
0 / 1
90.00
0.00% covered (danger)
0.00%
0 / 61
<?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\service\StudentSpecializationService;
class Template21IndividualResultGenerator extends RegularIndividualMarkCardResultDataGenerator
{
    public function __construct(){}
     /**
     * get Template Name
     * @param $request
     * @param $templateName
     */
    protected function getTemplateName($request){
        $templateName = "template_21";
        $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 = [];
        $examRegistrationData = $this->getExamRegistrationDetailsData($request);
        $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request);
        if(empty($studentsMarkDetails)){
            throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found");
        }
        $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/Template21/$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 = 297;
            $totalHeight = 210;
            $options = array(
                'page-width'     => $totalWidth."mm",
                'page-height'    => $totalHeight."mm",
                'dpi'            => 96,
                'margin-top' => "10mm",
                'margin-left' => "10mm",
                'margin-right' => "10mm",
                'margin-bottom' => "10mm",
                // '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
     * @param $studentsMarkDetails
     * @param $studentsDetails
     */
    protected function processStudentData($studentsMarkDetails, $request = null,$examRegistrationData = null){
        $response = new \stdClass;
        $totalStudentDetails = new \stdClass;
        $totalStudentDetails->totalStudents = count($studentsMarkDetails);
        $studentsDetails = [];
        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;
            $studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest);
            $subjectHistory = [];
            $totalCredit = 0;
            $earnedCredit = 0;
            $earnedCreditPoint = 0;
            $semesterCgpa = 0;
            foreach($studentSubjectHistory as $studentHistory){
                if($studentHistory->excludeSubjectFromTotal != 1){
                    if($subjectHistory[$studentHistory->paperSubjectId]){
                        if($subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint < $studentHistory->subjectCreditGradePoint){
                            $earnedCreditPoint += ($studentHistory->subjectCreditGradePoint - $subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint);
                            $subjectHistory[$studentHistory->paperSubjectId] = $studentHistory;
                            if($studentHistory->subjectFailedStatus == "PASSED"){
                                $earnedCredit += $studentHistory->credit;
                            }
                        }
                    }
                    else{
                        $earnedCreditPoint += $studentHistory->subjectCreditGradePoint;
                        $totalCredit += $studentHistory->credit;
                        $subjectHistory[$studentHistory->paperSubjectId] = $studentHistory;
                        if($studentHistory->subjectFailedStatus == "PASSED"){
                            $earnedCredit += $studentHistory->credit;
                        }
                    }
                }
            }
            $semesterCgpa = $earnedCreditPoint ? ($earnedCreditPoint/$totalCredit) : 0;
            $studentsDetails[$student->id]->slNo = "";
            $studentsDetails[$student->id]->failedStatus = $academicTerm->failedStatus;
            $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 = array_sum(array_column($student->academicTerms[0]->subjects,'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 = bcdiv($academicTerm->sgpa,1,2);
            $studentsDetails[$student->id]->semesterCgpa = bcdiv($semesterCgpa,1,2);
            $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;
            $studentsDetails[$student->id]->myImage = $student->studentDetails->myImage;
            $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo;
            $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo;
            $requestForSpecialization = new \stdClass;
            $requestForSpecialization->studentId = $student->id;
            $requestForSpecialization->groupId = $request->groupId;
            $studentSpecialisation = StudentSpecializationService::getInstance()-> getStudentspecialization($requestForSpecialization);
            if($studentSpecialisation){
                $student->specialization = $studentSpecialisation->name;
            }
            if( $request->isStudentSideExamResult == '1'){
                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 = array_sum(array_column($student->academicTerms[0]->subjects,'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 = array_sum(array_column($student->academicTerms[0]->subjects,'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;
            $studentsDetails[$student->id]->slNo = CommonExamService::getInstance()->getStudentExamMarkListSerialNumber($slNoRequest)->markListSerialNo;
            if ($studentsDetails[$student->id]->slNo) {
                $studentsDetails[$student->id]->slNo = str_pad($studentsDetails[$student->id]->slNo, 4, "0", STR_PAD_LEFT);
            }
            $studentsDetails[$student->id]->totalEarnedCredits = 0;
            foreach($student->academicTerms[0]->subjects as $subject){
                $studentsDetails[$student->id]->subjects[$subject->id]->id = $subject->id;
                $studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->name;
                $studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->code;
                $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;
                $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;
                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 = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB';
                    $studentsDetails[$student->id]->subjects[$subject->id]->grade = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB';
                }
                else if($subject->attendanceStatus == 'MALPRACTICE'){
                    $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'MAL';
                    $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'MAL';
                }
                else if($subject->failedStatus == 'FAILED'){
                    $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F';
                }
            }
            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->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;
        $examRegistrationDetails->programName = $examRegistrationDetailsArray[0]->groups[0]->programName;
        $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->batchEndYear = $examRegistrationDetailsArray[0]->groups[0]->groupProperties ? json_decode($examRegistrationDetailsArray[0]->groups[0]->groupProperties)->endYear:"";
        $examRegistrationDetails->deptID = $examRegistrationDetailsArray[0]->groups[0]->deptID;
        $examRegistrationDetails->deptName = $examRegistrationDetailsArray[0]->groups[0]->deptName;
        $examRegistrationDetails->degreeName = $examRegistrationDetailsArray[0]->groups[0]->degreeName;
        $examRegistrationDetails->streamName = $examRegistrationDetailsArray[0]->groups[0]->streamName;
        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;
    }
   
   
}