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 / 303
Template22IndividualResultGenerator
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 5
1640.00
0.00% covered (danger)
0.00%
0 / 303
 __construct
n/a
0 / 0
1
n/a
0 / 0
 getTemplateName
0.00% covered (danger)
0.00%
0 / 1
12.00
0.00% covered (danger)
0.00%
0 / 23
 processData
0.00% covered (danger)
0.00%
0 / 1
72.00
0.00% covered (danger)
0.00%
0 / 35
 renderIndividualMarkCardResult
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 36
 processStudentData
0.00% covered (danger)
0.00%
0 / 1
342.00
0.00% covered (danger)
0.00%
0 / 149
 getExamRegistrationDetailsData
0.00% covered (danger)
0.00%
0 / 1
72.00
0.00% covered (danger)
0.00%
0 / 60
<?php
// Template Individual Generator For STCP 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\ec\core\service\RuleService;
use com\linways\ec\core\request\SearchRuleRequest;
use com\linways\ec\core\service\StudentsOverAllMarkReportService;
use com\linways\core\ams\professional\service\StudentService;
class Template22IndividualResultGenerator extends RegularIndividualMarkCardResultDataGenerator
{
    public function __construct(){}
     /**
     * get Template Name
     * @param $request
     * @param $templateName
     */
    protected function getTemplateName($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->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->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;
        if($examRegistrationDetails->courseTypeName == "PG"){
            $templateName = "template_22_pg";
        }
        else{
            $templateName = "template_22";
        }
        return $templateName;
    }
    /**
     * Process Student data college base
     * @param $request
     */
    protected function processData($request){
        $response = new \stdClass;
        $studentsMarkDetails = [];
        $request->orderByCurriculum = 1;
        $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request);
        if(empty($studentsMarkDetails)){
            throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found");
        }
        $responseOfStudentData = $this->processStudentData($studentsMarkDetails, $request);
        $response->studentData = $responseOfStudentData->studentsDetails;
        $response->totalStudentData = $responseOfStudentData->totalStudentDetails;
        if( $request->isStudentSideExamResult == '1' && !$request->groupId){
            $request->groupId = reset($studentsMarkDetails)->studentDetails->batchId;
        }
        $response->examRegistrationData = $this->getExamRegistrationDetailsData($request);
        $response->collegeAndOtherData = CommonExamService::getInstance()->getCollegeDetails($request);
        $response->classTypes = ['THEORY','PRACTICAL'];
        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;
        if( $request->isStudentSideExamResult == '1' ){
            $response->displayContentOptions->collegeHeaderAndLogoFlag = '1';
        }
        else{
            $response->displayContentOptions->collegeHeaderAndLogoFlag = '0';
            $response->displayContentOptions->isShowDefaultSealAndSign = '0';
        }
        $response->isStudentSideExamResult =  $request->isStudentSideExamResult == '1' ? true : false;
        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/Template22/$templateName.twig"), [ 'data'=>$data ]);
            $prtContent = NULL;
            $prtContent .= '<html><head>';
            $prtContent .= "<style>
                h6 {font-size: 26px;} 
                .text-center { text-align: center;} 
                .align-middle {vertical-align: middle;}; 
                table, th, td {border: 1px solid black;border-collapse: collapse;} 
                .no-border-tr td, .no-border-table tbody tr td { border-right:1px solid #fff !important; border-left:1px solid #fff !important; border-top:1px solid #fff !important;border-bottom:1px solid #fff !important;};
                </style>";
            $prtContent .= '</head><title>Individual Mark Card</title><body>';
            $prtContent .= $responseHtml;
            $prtContent .= '</body></html>'; 
            $prtContent .= '</head><title>Individual Mark Card</title><body>';
            $totalWidth = 210;
            $totalHeight = 297;
            $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 = $prtContent;
            $programResult->printData = PdfUtil::renderPdf($prtContent, $options);
        return  $programResult;
        
    }
    /**
     * processStudentData
     * @param $studentsMarkDetails
     * @param $studentsDetails
     */
    protected function processStudentData($studentsMarkDetails, $request = null){
        $response = new \stdClass;
        $totalStudentDetails = new \stdClass;
        $totalStudentDetails->totalStudents = count($studentsMarkDetails);
        $studentsDetails = [];
        $categoryRequest = new \stdClass();
        $categoryRequest->groupId = $request->groupId;
        $categoryRequest->academicTermId = reset($studentsMarkDetails)->academicTerms[0]->id;
        $paperDetails = CommonExamService::getInstance()->geSubjectPaperDetails($categoryRequest);
        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;
            $studentsDetails[$student->id]->myImage  = StudentService::getInstance()->getStudentProfilePic($student->id)->docpath;
            
            $academicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($request){
                return $value->examRegistrationId == $request->examRegistrationId;
            }));
            $studentsDetails[$student->id]->failedStatus = $academicTerm->failedStatus;
            $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo;
            $studentsDetails[$student->id]->abcId = $student->studentDetails->abcId;
            $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo;
            $studentsDetails[$student->id]->degreeName = $student->studentDetails->degree;
            $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 35% mark or P grade is necessary." : "For a pass in each course 35% mark or P grade is necessary.";
            $studentsDetails[$student->id]->roundOff = 2;
            $studentsDetails[$student->id]->semesterSgpa = round($academicTerm->sgpa, $studentsDetails[$student->id]->roundOff);
            $studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $studentsDetails[$student->id]->semesterSgpa);
            $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 ++;
            }
            if($student->studentDetails->courseTypeName == "PG"){
                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]->externalMaxMark = $subject->externalMaxMark;
                    $studentsDetails[$student->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark;
                    $studentsDetails[$student->id]->subjects[$subject->id]->priority = intval($subject->priority);
                    $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 + $subject->graceMark;
                    $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]->attendanceStatus = $subject->attendanceStatus;
                    $studentsDetails[$student->id]->subjects[$subject->id]->credit = $subject->credit;
                    $studentsDetails[$student->id]->subjects[$subject->id]->creditGradePoint = $subject->subGradePoint * $subject->credit;
                    $studentsDetails[$student->id]->subjects[$subject->id]->gradePoint = $subject->subGradePoint;
                    $studentsDetails[$student->id]->subjects[$subject->id]->internalGrade = $subject->isInternal ? $subject->internalGrade : "-";
                    $studentsDetails[$student->id]->subjects[$subject->id]->externalGrade = $subject->externalGrade;
                    $studentsDetails[$student->id]->subjects[$subject->id]->internalGradePoint = $subject->isInternal ? $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]->percentageObtainedExternal = $subject->percentageObtainedExternal;
                    $studentsDetails[$student->id]->subjects[$subject->id]->percentageObtainedInternal = $subject->percentageObtainedInternal;
                    $currentPaperDetails = reset(array_filter($paperDetails,function($paper)use($subject){
                        return array_filter($paper->subjects,function($value)use($subject){
                            return $value->academicPaperSubjectId == $subject->id;
                        });
                    }));
                    $currentSubjectDetails = reset(array_filter($currentPaperDetails->subjects,function($currentSubject)use($subject){
                        return $currentSubject->academicPaperSubjectId == $subject->id;
                    }));
                    $studentsDetails[$student->id]->subjects[$subject->id]->isTheory = $currentSubjectDetails->isTheory == '0' ? false : true;
                }
            }
            else{
                $studentSubCoursesReq = new \stdClass();
                $studentSubCoursesReq->studentId = $student->id;
                $subCourseSubjects = StudentsOverAllMarkReportService::getInstance()->getSubCourseRelationBystudent($studentSubCoursesReq);
                foreach($student->academicTerms[0]->subjects as $subject){
                    $isTheory = strpos($subject->classType, 'THEORY') !== false ? true : false;
                    $strVar = "THEORY";
                    if( !$isTheory ){
                        $strVar = "PRACTICAL";
                    }
                    if( $subCourseSubjects[$subject->amsSubjectId] ){
                        $subject->name = $subCourseSubjects[$subject->amsSubjectId]->parentName;
                        $subject->code = $subCourseSubjects[$subject->amsSubjectId]->parentCode;
                        $subject->amsSubjectId = $subCourseSubjects[$subject->amsSubjectId]->parentSubjectId;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->isSubCourse = true;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesResultStatus = $subject->subCoursesResultStatus;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesGradePoint = $subject->subCoursesGradePoint;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesCreditGradePoint = $subject->subCoursesCreditGradePoint;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesInternalMark = $subject->subCoursesInternalMark;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesExternalMark = $subject->subCoursesExternalMark;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesTotalMaxMark = $subject->subCoursesTotalMaxMark;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesTotalObtainedMark = $subject->subCoursesTotalObtainedMark;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesExternalMaxMark = $subject->subCoursesExternalMaxMark;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesInternalMaxMark = $subject->subCoursesInternalMaxMark;
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCoursesGrade = $subject->subCoursesGrade;
                    }
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->id = $subject->amsSubjectId;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subjectTypeName = $subject->subjectTypeName;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->name = $subject->name;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->code = $subject->code;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->externalMaxMark = $subject->externalMaxMark;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->internalMaxMark = $subject->internalMaxMark;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->priority = intval($subject->priority);
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->class = $subject->class;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->grade = $subject->grade;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->percentage = $subject->percentage;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->internalMark = $subject->internalMark;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->externalMark = $subject->externalMark + $subject->graceMark;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->totalMaxMark = $subject->totalMarks;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->markObtained = $subject->markObtained;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->failedStatus = $subject->isFailed;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->attendanceStatus = $subject->attendanceStatus;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->credit = $subject->credit;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->creditGradePoint = $subject->subGradePoint * $subject->credit;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->gradePoint = $subject->subGradePoint;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->internalGrade = $subject->isInternal ? $subject->internalGrade : "-";
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->externalGrade = $subject->externalGrade;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->internalGradePoint = $subject->isInternal ? $subject->internalGradePoint : "-";
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->externalGradePoint = $subject->externalGradePoint;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->isInternal = $subject->isInternal;
                    $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses[$strVar]->isExternal = $subject->isExternal;
                    if( $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->isSubCourse ){
                        $studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCount = count($studentsDetails[$student->id]->subjects[$subject->amsSubjectId]->subCourses);
                    }
                }
            }
            // 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); 
        }
        $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->programName = $examRegistrationDetailsArray[0]->groups[0]->programName;
        $examRegistrationDetails->academicTermName = $examRegistrationDetailsArray[0]->groups[0]->academicTermName;
        $examRegistrationDetails->academicTermYear = $examRegistrationDetailsArray[0]->groups[0]->academicTermYear;
        $examRegistrationDetails->subsidiaryCourseName = $examRegistrationDetailsArray[0]->groups[0]->subsidiaryCourseName;
        $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->publishingStartDate = $examRegistrationDetailsArray[0]->groups[0]->examBatchProperties->publishingStartDate;
        $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;
    }
    
   
}