Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 13 |
CRAP | |
0.00% |
0 / 2458 |
| getProjectCredits | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 6 |
|||
| Template5MigrationdResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 12 |
322056.00 | |
0.00% |
0 / 2452 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| processData | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 79 |
|||
| getStudentsOverallMarkReport | |
0.00% |
0 / 1 |
62750.00 | |
0.00% |
0 / 815 |
|||
| markListProcessing | |
0.00% |
0 / 1 |
31506.00 | |
0.00% |
0 / 1040 |
|||
| getStudentSubjectGradeDetailsForMarkHistory | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 37 |
|||
| getGradeByPercentage | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 8 |
|||
| getStudentImprovementExamDetailsForThisExam | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 16 |
|||
| getStudentExamDetails | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| getSupplyMarkHistory | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 22 |
|||
| checkIsFailedByPassPercentCriteria | |
0.00% |
0 / 1 |
420.00 | |
0.00% |
0 / 44 |
|||
| getSemesterGradeDetials | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 9 |
|||
| getStudentsSupplyMarkReport | |
0.00% |
0 / 1 |
5852.00 | |
0.00% |
0 / 333 |
|||
| recalculateForExceptionalCase | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 34 |
|||
| <?php | |
| // For SCEK | |
| namespace com\linways\ec\core\service\MarkMigrationGenerator; | |
| 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\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\service\MarkMigrationGenerator\MarkMigrationResultDataGenerator; | |
| use com\linways\ec\core\service\StudentsOverAllMarkReportService; | |
| use com\linways\ec\core\service\ExamRevaluationService; | |
| use com\linways\ec\core\request\ConsolidatedOverAllMarkReportRequest; | |
| use com\linways\core\ams\professional\dto\ExamType; | |
| use com\linways\ec\core\service\GradeSchemeService; | |
| use com\linways\core\ams\professional\constant\examcontroller\ExamSubjectTypeConstants; | |
| use com\linways\ec\core\constant\ExamRegistrationTypeConstants; | |
| use com\linways\ec\core\service\RuleService; | |
| use com\linways\ec\core\request\SearchRuleRequest; | |
| class Template5MigrationdResultGenerator extends MarkMigrationResultDataGenerator | |
| { | |
| public function __construct(){} | |
| /** | |
| * Process Student data college base | |
| * @param $request | |
| */ | |
| protected function processData($searchReq){ | |
| $request = new ConsolidatedOverAllMarkReportRequest(); | |
| $request->isStudentWiseImport = $searchReq->isStudentWiseImport; | |
| $request->groupId = $searchReq->groupId; | |
| $request->isConsolidatedRequest = TRUE; | |
| $request->examRegistrationType = "REGULAR"; | |
| $request->fetchMarkHistory = 1; | |
| $request->isRoundOff = 1; | |
| $request->considerSupplyImproveCombined = 1; | |
| // $request->academicTermId = 6; | |
| $request->studentId = $searchReq->studentId; | |
| // $request->studentId = 1905; | |
| $request->staffId = $searchReq->staffId; | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "IMPORT_MARK_RULES"; | |
| $ruleSettings = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $request->ruleSettings = $ruleSettings; | |
| $request->considerOverallReportForGraceMark = 1; | |
| if ($ruleSettings){ | |
| $request->considerOverallReportForGraceMark = $ruleSettings->considerOverallReportForGraceMark; | |
| } | |
| $pulishedSupplyRegId = StudentsOverAllMarkReportService::getInstance()->getPublishedSupplyExamRegistrationByStudentId($request); | |
| $request->supplyRegIdArray = $pulishedSupplyRegId; | |
| $request->considerFeStudents = 1; | |
| $request->studentRegularExamDetails = []; | |
| $studentRegularExamDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($request); | |
| $request->considerFeStudents = false; | |
| if(empty($studentRegularExamDetails)){ | |
| return; | |
| // throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $request->studentRegularExamDetails = $studentRegularExamDetails; | |
| $request->improvementExamDetails = []; | |
| if ( $request->considerImprovement ) { | |
| $request->examRegistrationType = ExamRegistrationTypeConstants::SUPPLEMENTARY; | |
| $request->subjectRegistrationType = ExamRegistrationTypeConstants::IMPROVEMENT; | |
| $request->improvementExamDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($request); | |
| $request->subjectRegistrationType = ""; | |
| } | |
| $request->supplyExamDetails = []; | |
| if ( $request->considerSupplementary ) { | |
| $request->examRegistrationType = ExamRegistrationTypeConstants::SUPPLEMENTARY; | |
| $request->subjectRegistrationType = ExamRegistrationTypeConstants::SUPPLEMENTARY; | |
| $request->supplyExamDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($request); | |
| $request->subjectRegistrationType = ""; | |
| } | |
| $request->moderationMarkDetails = []; | |
| if ( $request->considerModerationMark ) { | |
| $request->examRegistrationType = ""; | |
| $request->requestType = "MODERATION"; | |
| $request->moderationMarkDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($request); | |
| } | |
| $request->graceMarkDetails = []; | |
| if ( $request->considerGraceMark ) { | |
| $request->examRegistrationType = ""; | |
| $request->requestType = "GRACEMARK"; | |
| $request->graceMarkDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($request); | |
| } | |
| $studentExamDetails = json_decode(json_encode($studentRegularExamDetails)); | |
| $projectRequest = new \stdClass(); | |
| $projectRequest->studentId = $request->studentId; | |
| $projectRequest->subjectCategory = "PROJECT"; | |
| $request->projectSubjects = StudentsOverAllMarkReportService::getInstance()->getSubjectCategoryByRequest($projectRequest); | |
| $lowPassRequest = new \stdClass(); | |
| $lowPassRequest->studentId = $request->studentId; | |
| $request->studentLowPassApplications = StudentsOverAllMarkReportService::getInstance()->getStudentLowPassGradeDetails($lowPassRequest); | |
| $studentDetails = $this->getStudentsOverallMarkReport($request, $studentExamDetails); | |
| $consolidatedMarkDetails = reset($this->markListProcessing($request, $studentDetails, $studentRegularExamDetails)); | |
| if (!empty($consolidatedMarkDetails)) { | |
| StudentsOverAllMarkReportService::getInstance()->updateStudentSubjectActiveStatus($request); | |
| foreach ($consolidatedMarkDetails->semMarks as $semester) { | |
| foreach ($semester->subject as $subject) { | |
| $subject->consolidated->staffId = $request->staffId; | |
| StudentsOverAllMarkReportService::getInstance()->insertStudentSubjectConsolidatedMarkDetails($subject->consolidated); | |
| } | |
| $semester->consolidated->staffId = $request->staffId; | |
| StudentsOverAllMarkReportService::getInstance()->insertStudentSemesterConsolidatedMarkDetails($semester->consolidated); | |
| } | |
| $consolidatedMarkDetails->consolidated->staffId = $request->staffId; | |
| StudentsOverAllMarkReportService::getInstance()->insertStudentCourseConsolidatedMarkDetails($consolidatedMarkDetails->consolidated); | |
| StudentsOverAllMarkReportService::getInstance()->deleteStudentEditstatus($request); | |
| } | |
| } | |
| /** | |
| * @param ConsolidatedOverAllMarkReportRequest $request | |
| * @param $examDetails | |
| * @return array | |
| */ | |
| protected function getStudentsOverallMarkReport ( ConsolidatedOverAllMarkReportRequest $request, $examDetails ) | |
| { | |
| if ( empty ( $examDetails ) ) { | |
| return null; | |
| } | |
| if ($request->fetchOnlyMark) { | |
| $subjectMark = []; | |
| } | |
| $examGroupId = current($examDetails)->batch->groupId; | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $examGroupId; | |
| $searchRequest->academicTermId = $request->academicTermId; | |
| $searchRequest->requestType = "CURRICULAM"; | |
| $cgpaGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $cgpaGradeDetails = reset($cgpaGradeSchemeArray)->grades; | |
| if ( $request->considerImprovement ) { | |
| $improvementExamDetails = $request->improvementExamDetails; | |
| } | |
| if ( $request->considerSupplementary ) { | |
| $supplyExamDetails = $request->supplyExamDetails; | |
| } | |
| if ( $request->considerModerationMark ) { | |
| $moderationMarkDetails = $request->moderationMarkDetails; | |
| } | |
| if ( $request->considerGraceMark ) { | |
| $graceMarkDetails = $request->graceMarkDetails; | |
| } | |
| $student = []; | |
| $passCriteriaArray = []; | |
| $creditGradePoint = 0; | |
| $aggregatePassCriteria = null; | |
| $batchStartYear = reset($examDetails)->batch->startYear; | |
| $courseTypeId = reset($examDetails)->batch->courseTypeId; | |
| $courseType = new \stdClass(); | |
| $courseType->courseTypeMethod = reset($examDetails)->batch->courseType; | |
| $courseType->courseTypeName = reset($examDetails)->batch->courseTypeName; | |
| $courseType->isPG = 0; | |
| if ($courseType->courseTypeMethod == 'PG') { | |
| $courseType->isPG = 1; | |
| } | |
| // Enable internal normalization based on rule settings | |
| if ($request->ruleSettings->internalNormalizationSettings) { | |
| foreach ($request->ruleSettings->internalNormalizationSettings as $internalNormalizationSetting) { | |
| if (in_array($courseTypeId, explode(',', $internalNormalizationSetting->courseType)) && in_array($batchStartYear, explode(',', $internalNormalizationSetting->batchStartYear))) { | |
| $request->enableInternalNormalization = true; | |
| } | |
| } | |
| } | |
| $failedSemMarks = []; | |
| $lastExamYear = $lastExamMonth = 0; | |
| foreach ($examDetails as $exam) { | |
| $lastSubjectExamYear = $lastSubjectExamMonth = 0; | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $exam->batch->groupId;; | |
| $searchRequest->academicTermId = $exam->semester->academicTermId; | |
| $searchRequest->academicPaperSubjectId = $exam->subject->academicPaperSubjectId; | |
| $subjectGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $searchRequest->requestType = "SEMESTER"; | |
| $semesterGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $lastSubjectExamYear = $exam->examRegistrations->year; | |
| $lastSubjectExamMonth = $exam->examRegistrations->month; | |
| if ($lastExamYear < $exam->examRegistrations->year) { | |
| $lastExamYear = $exam->examRegistrations->year; | |
| $lastExamMonth = $exam->examRegistrations->month; | |
| } else if ($lastExamYear == $exam->examRegistrations->year) { | |
| $lastExamMonth = $lastExamMonth < $exam->examRegistrations->month ? $exam->examRegistrations->month : $lastExamMonth; | |
| } | |
| $semesterGradeKey = array_search($exam->semester->academicTermId, array_column( $semesterGradeSchemeArray, "id")); | |
| if($semesterGradeKey || $semesterGradeKey === 0){ | |
| $semesterGradeDetails = $semesterGradeSchemeArray[$semesterGradeKey]->grades; | |
| } | |
| $maxSemesterGradePercent = $semesterGradeDetails[0]->rangeTo; | |
| $subjectGradeKey = array_search($exam->subject->academicPaperSubjectId, array_column( $subjectGradeSchemeArray, "id")); | |
| $gradeDetails = ''; | |
| if($subjectGradeKey || $subjectGradeKey === 0){ | |
| $gradeDetails = $subjectGradeSchemeArray[$subjectGradeKey]->grades; | |
| } | |
| $maxGradePercent = $gradeDetails[0]->rangeTo; | |
| $maxGradePoint = max(array_column($gradeDetails,"gradePoint")); | |
| $academicTermId = $exam->semester->academicTermId; | |
| $academicPaperSubjectId = $exam->subject->academicPaperSubjectId; | |
| $schemeType = "PERCENTAGE"; | |
| $passCriteriaArray[$academicPaperSubjectId] = GradeSchemeService::getInstance()->getSubjectPassCriteriaByAcademicPaperSubject($academicPaperSubjectId, $schemeType); | |
| $internalPassCriteria = $externalPassCriteria = $overallPassCriteria = $aggregatePassCriteria = null; | |
| $internalPassCriteria = $passCriteriaArray[$academicPaperSubjectId]->internalPassCriteria; | |
| $externalPassCriteria = $passCriteriaArray[$academicPaperSubjectId]->externalPassCriteria; | |
| $overallPassCriteria = $passCriteriaArray[$academicPaperSubjectId]->overallPassCriteria; | |
| if (!empty ($exam->studentMarks)) { | |
| foreach ($exam->studentMarks as $studentMark) { | |
| $isFailed = 0; | |
| $isInternalFailed = 0; | |
| $isExternalFailed = 0; | |
| $examTotal = 0; | |
| $studentExamTotal = 0; | |
| $studentExternalMark = null; | |
| $moderationMark = null; | |
| $grade = null; | |
| $studentId = $studentMark->student->studentId; | |
| $isExempted = $studentMark->isExempted; | |
| $lastSemId = $exam->batch->finalTermId; | |
| $student[$studentId]->semMarks[$academicTermId]->academicTermName = $exam->semester->academicTermName; | |
| $markHistory = []; | |
| $examMonth = $exam->examRegistrations->month; | |
| $examYear = $exam->examRegistrations->year; | |
| $monthYearOfPassing = date ( "M Y", strtotime ( $exam->examRegistrations->year . "-" . $exam->examRegistrations->month . "-01")); | |
| $examRegTypeOfPassing = ExamType::REGULAR; | |
| if ( $isExempted == 0 ) { | |
| $considerOverallPassCriteriaOnly = 0; | |
| if ( $exam->subject->subjectType == ExamSubjectTypeConstants::OPEN_ELECTIVE || | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::FOUNDATION_COURSE || | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::TERM_PAPER ) { | |
| $considerOverallPassCriteriaOnly = 1; | |
| } | |
| /** | |
| * Object created for checking whether a student is passed for a subject by the pass percent | |
| * criteria | |
| */ | |
| $checkPassPercentCriteria = new \stdClass(); | |
| $checkPassPercentCriteria->isInternal = $exam->subject->isInternal; | |
| $checkPassPercentCriteria->isTheory = $exam->subject->isTheory; | |
| $checkPassPercentCriteria->internalMaxMark = $exam->internalMaxMark; | |
| $checkPassPercentCriteria->isExternal = $exam->subject->isExternal; | |
| $checkPassPercentCriteria->externalMaxMark = $exam->externalMaxMark; | |
| $checkPassPercentCriteria->internalMark = round($studentMark->internalMark, 2); | |
| $checkPassPercentCriteria->considerOverallPassCriteriaOnly = $considerOverallPassCriteriaOnly; | |
| $checkPassPercentCriteria->passPercentConfig = $passCriteriaArray[$academicPaperSubjectId]; | |
| /** Code ends **/ | |
| if ( !$student[$studentId]->lastExamYear || $student[$studentId]->lastExamYear < $lastExamYear ) { | |
| $student[$studentId]->lastExamYear = $lastExamYear; | |
| $student[$studentId]->lastExamMonth = $lastExamMonth; | |
| $student[$studentId]->lastExamReg = ExamType::REGULAR; | |
| } else if ( $student[$studentId]->lastExamYear == $lastExamYear && | |
| $student[$studentId]->lastExamMonth < $lastExamMonth ) { | |
| $student[$studentId]->lastExamMonth = $lastExamMonth; | |
| $student[$studentId]->lastExamReg = ExamType::REGULAR; | |
| } | |
| if ( !$student[$studentId]->semMarks[$academicTermId]->lastExamYear || $student[$studentId]->semMarks[$academicTermId]->lastExamYear < $lastSubjectExamYear ) { | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamYear = $lastSubjectExamYear; | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamMonth = $lastSubjectExamMonth; | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamReg = ExamType::REGULAR; | |
| } else if ( $student[$studentId]->semMarks[$academicTermId]->lastSubjectExamYear == $lastSubjectExamYear && | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamMonth < $lastSubjectExamMonth ) { | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamMonth = $lastSubjectExamMonth; | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamReg = ExamType::REGULAR; | |
| } | |
| //--------normalize external marks with special consideration------------- | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "SPECIAL_CONSIDERATION_FOR_EXTERNAL_MARK"; | |
| $markRuleSetting = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $markRuleSetting->maxMark = $markRuleSetting->maxMark ? $markRuleSetting->maxMark : $exam->externalMaxMark; | |
| if ($exam->subject->isExternal && $studentMark->externalMark && !$exam->subject->excludeSubjectFromTotal) { | |
| if ($markRuleSetting) { | |
| $markRuleSetting->maxMark = round($markRuleSetting->maxMark,2); | |
| $studentMark->externalMark = round($studentMark->externalMark,2); | |
| if ((($markRuleSetting->isTheory && $exam->subject->isTheory) || ($markRuleSetting->isPractical && !$exam->subject->isTheory)) && $studentMark->externalMark < $markRuleSetting->maxMark) { | |
| $marRuleRegIds = $markRuleSetting->examregIds; | |
| if (in_array($exam->examRegistrations->examRegistrationId, $marRuleRegIds)) { | |
| $studentMark->examMark->markNormalized = ($markRuleSetting->calculation == "+") ? ($studentMark->externalMark + $markRuleSetting->markRule) : ($studentMark->externalMark * $markRuleSetting->markRule); | |
| $studentMark->examMark->markNormalized = (($studentMark->examMark->markNormalized) > $exam->externalMaxMark) ? $exam->externalMaxMark : $studentMark->examMark->markNormalized; | |
| if ($markRuleSetting->additionalMarkLimit && (($studentMark->examMark->markNormalized - $studentMark->externalMark ) > $markRuleSetting->additionalMarkLimit)) { | |
| $studentMark->examMark->markNormalized = $studentMark->externalMark + $markRuleSetting->additionalMarkLimit; | |
| } | |
| $studentMark->examMark->markNormalized = ($studentMark->examMark->markNormalized > $markRuleSetting->maxMark) ? $markRuleSetting->maxMark : $studentMark->examMark->markNormalized; | |
| $studentMark->externalMark = round($studentMark->examMark->markNormalized, 2); | |
| } | |
| } | |
| } | |
| } | |
| //-------END normalize external marks with special consideration------------- | |
| $studentMark->externalAttendanceStatus = $studentMark->externalAttendanceStatus? $studentMark->externalAttendanceStatus : 'PRESENT'; | |
| $studentExternalMark = $studentMark->externalMark; | |
| $checkPassPercentCriteria->externalMark = $studentExternalMark; | |
| $isRegularFailed = $this->checkIsFailedByPassPercentCriteria ( | |
| $checkPassPercentCriteria ); | |
| $markHistory["REGULAR"]->isFailed = $isRegularFailed; | |
| $markHistory["REGULAR"]->mark = $studentMark->externalMark; | |
| $markHistory["REGULAR"]->markObtainedInExam = round($studentMark->externalMark, 2); | |
| $markHistory["REGULAR"]->examRegistrationId = $exam->examRegistrations->examRegistrationId; | |
| $markHistory["REGULAR"]->month = $exam->examRegistrations->month; | |
| $markHistory["REGULAR"]->year = $exam->examRegistrations->year; | |
| $markHistory["REGULAR"]->assessmentId = $exam->assessmentId; | |
| $markHistory["REGULAR"]->oeExamId = $exam->oeExamId; | |
| $markHistory["REGULAR"]->externalAttendanceStatus = $studentMark->externalAttendanceStatus; | |
| $markHistory["REGULAR"]->name = $exam->examRegistrations->examRegistartionName; | |
| $markHistory["REGULAR"]->studentAttendanceStatus = $studentMark->studentAttendanceStatus; | |
| // Only if there is any significant improvement in the mark then only there will be entry in the revaluation mark table | |
| if ( $request->considerRevaluation) { | |
| $revalRequest = new \stdClass(); | |
| $revalRequest->studentId = $studentId; | |
| $revalRequest->assessmentId = $exam->assessmentId; | |
| $revalRequest->orderByHighestMark = 1; | |
| $studentRevaluationDetails = StudentsOverAllMarkReportService::getInstance()->getStudentFinalizedRevaluationMark($revalRequest); | |
| if($studentRevaluationDetails){ | |
| $studentRevaluationDetail = current(current($studentRevaluationDetails)->students); | |
| //--------normalize external - revaluation marks with special consideration------------- | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "SPECIAL_CONSIDERATION_FOR_EXTERNAL_MARK"; | |
| $markRuleSetting = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $markRuleSetting->maxMark = $markRuleSetting->maxMark ? $markRuleSetting->maxMark : $exam->externalMaxMark; | |
| if ($exam->subject->isExternal && $studentRevaluationDetail->revaluationMark && !$exam->subject->excludeSubjectFromTotal) { | |
| if ($markRuleSetting) { | |
| if ((($markRuleSetting->isTheory && $exam->subject->isTheory) || ($markRuleSetting->isPractical && !$exam->subject->isTheory)) && $studentRevaluationDetail->revaluationMark < $markRuleSetting->maxMark) { | |
| $marRuleRegIds = $markRuleSetting->examregIds; | |
| if (in_array($exam->examRegistrations->examRegistrationId, $marRuleRegIds)) { | |
| $studentRevaluationMarkNormalized = ($markRuleSetting->calculation == "+") ? ($studentRevaluationDetail->revaluationMark + $markRuleSetting->markRule) : ($studentRevaluationDetail->revaluationMark * $markRuleSetting->markRule); | |
| $studentRevaluationMarkNormalized = (($studentRevaluationMarkNormalized) > $exam->externalMaxMark) ? $exam->externalMaxMark : $studentRevaluationMarkNormalized; | |
| if ($markRuleSetting->additionalMarkLimit && (($studentRevaluationMarkNormalized - $studentRevaluationDetail->revaluationMark) > $markRuleSetting->additionalMarkLimit)) { | |
| $studentRevaluationMarkNormalized = $studentRevaluationDetail->revaluationMark + $markRuleSetting->additionalMarkLimit; | |
| } | |
| $studentRevaluationMarkNormalized = ($studentRevaluationMarkNormalized > $markRuleSetting->maxMark) ? $markRuleSetting->maxMark : $studentRevaluationMarkNormalized; | |
| $studentRevaluationDetail->revaluationMark = round($studentRevaluationMarkNormalized, 2); | |
| } | |
| } | |
| } | |
| } | |
| //-------END normalize external - revaluation marks with special consideration------------- | |
| if($studentRevaluationDetail->revaluationMark){ | |
| $studentExternalMark = $studentRevaluationDetail->revaluationMark; | |
| $markHistory["REGULAR"]->mark = $studentRevaluationDetail->revaluationMark; | |
| $markHistory["REGULAR"]->markType['REVALUATION']->mark = $studentRevaluationDetail->revaluationMark; | |
| $markHistory["REGULAR"]->markType['REVALUATION']->revaluationId = $studentRevaluationDetail->revaluationId; | |
| $studentMark->isRegularRevaluationMark = true; | |
| // $markHistory["REVALUATION"]->examRegId = $studentRevaluationDetail->revaluationId; | |
| // $markHistory["REVALUATION"]->isAbsent = false; | |
| // $markHistory["REVALUATION"]->name = $studentRevaluationDetail->revalDesc; | |
| } | |
| } | |
| } | |
| if ( $request->considerGraceMark ) { | |
| $studentGraceMark = $this->getStudentExamDetails($exam->assessmentId, $studentId, $graceMarkDetails); | |
| if($studentGraceMark){ | |
| $studentExternalMark+= $studentGraceMark->externalMark; | |
| $markHistory["REGULAR"]->markType['GRACEMARK']->mark = $studentGraceMark->externalMark; | |
| } | |
| } | |
| if ( $request->considerSupplementary ) { | |
| $studentSupplyExam = null; | |
| // Get the mark of the last supplementary exam registered by that student | |
| $supplyRequest = new ConsolidatedOverAllMarkReportRequest(); | |
| // $supplyRequest->groupId = $request->groupId; | |
| $supplyRequest->isConsolidatedRequest = TRUE; | |
| $supplyRequest->examRegistrationType = ExamRegistrationTypeConstants::SUPPLEMENTARY; | |
| $supplyRequest->academicPaperSubjectId = $academicPaperSubjectId; | |
| $supplyRequest->studentId = $studentId; | |
| $supplyRequest->orderBy = "HIGHEST"; | |
| $supplyRequest->supplementaryYearUpperLimit = $request->supplementaryYearUpperLimit; | |
| $supplyRequest->supplementaryMonthUpperLimit = $request->supplementaryMonthUpperLimit; | |
| $supplyRequest->considerSupplyImproveCombined = $request->considerSupplyImproveCombined; | |
| $supplyRequest->studentSupplyRequest = true; | |
| $studentSupplyExam = reset(StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($supplyRequest)); | |
| $supplyRequest->studentSupplyRequest = false; | |
| $studentExternalMark = round($studentExternalMark, 2); | |
| if (!empty ($studentSupplyExam)) { | |
| $supplyStudentDetails = current($studentSupplyExam->studentMarks); | |
| if( $supplyStudentDetails->improvedInternalMark){ | |
| $studentMark->internalMark = $studentMark->internalMark > $supplyStudentDetails->improvedInternalMark ? $studentMark->internalMark : round($supplyStudentDetails->improvedInternalMark); | |
| $studentMark->internalAttendanceStatus = "PRESENT"; | |
| } | |
| if ( $request->considerGraceMark ) { | |
| $studentGraceMark = $this->getStudentExamDetails($studentImproveExamMark->assessmentId, $studentId, $graceMarkDetails); | |
| if($studentGraceMark){ | |
| $supplyStudentDetails->externalMark += $studentGraceMark->externalMark; | |
| } | |
| } | |
| $studentSupplyExamMark = round($supplyStudentDetails->externalMark, 2); | |
| if ( $supplyStudentDetails->externalAttendanceStatus == "PRESENT" ) { | |
| $studentMark->externalAttendanceStatus = $supplyStudentDetails->externalAttendanceStatus ? $supplyStudentDetails->externalAttendanceStatus : $studentMark->externalAttendanceStatus; | |
| $lastSupplyRegType = ExamType::SUPPLY; | |
| if( $supplyStudentDetails->studentExamRegType == ExamType::IMPROVEMENT){ | |
| $lastSupplyRegType = ExamType::IMPROVEMENT; | |
| } | |
| $supplyExamMonth = (int)$studentSupplyExam->examRegistrations->month; | |
| $supplyExamYear = (int)$studentSupplyExam->examRegistrations->year; | |
| if( $lastSupplyRegType == ExamType::SUPPLY){ | |
| if ($student[$studentId]->lastSupplyYear < $supplyExamYear) { | |
| $student[$studentId]->lastSupplyYear = $supplyExamYear; | |
| $student[$studentId]->lastSupplyMonth = $supplyExamMonth; | |
| } else if ($student[$studentId]->lastSupplyYear == $supplyExamYear && | |
| $student[$studentId]->lastSupplyMonth < $supplyExamMonth) { | |
| $student[$studentId]->lastSupplyMonth = $supplyExamMonth; | |
| } | |
| } | |
| if ($student[$studentId]->lastExamYear < $supplyExamYear) { | |
| $student[$studentId]->lastExamYear = $supplyExamYear; | |
| $student[$studentId]->lastExamMonth = $supplyExamMonth; | |
| $student[$studentId]->lastExamReg = $lastSupplyRegType; | |
| } else if ($student[$studentId]->lastExamYear == $supplyExamYear && | |
| $student[$studentId]->lastExamMonth < $supplyExamMonth) { | |
| $student[$studentId]->lastExamMonth = $supplyExamMonth; | |
| $student[$studentId]->lastExamReg = $lastSupplyRegType; | |
| } | |
| if ($student[$studentId]->semMarks[$academicTermId]->lastExamYear < $supplyExamYear) { | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamYear = $supplyExamYear; | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamMonth = $supplyExamMonth; | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamReg = $lastSupplyRegType; | |
| } else if ($student[$studentId]->semMarks[$academicTermId]->lastExamYear == $supplyExamYear && | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamMonth < $supplyExamMonth) { | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamMonth = $supplyExamMonth; | |
| $student[$studentId]->semMarks[$academicTermId]->lastExamReg = $lastSupplyRegType; | |
| } | |
| $examMonth = $supplyExamMonth; | |
| $examYear = $supplyExamYear; | |
| $monthYearOfPassing = date("M Y", strtotime($supplyExamYear . "-" . $supplyExamMonth . "-01")); | |
| $examRegTypeOfPassing = $lastSupplyRegType; | |
| } | |
| if ($studentSupplyExamMark ) { | |
| // $studentExternalMark = $studentSupplyExamMark; | |
| $studentMark->externalAttendanceStatus = $supplyStudentDetails->externalAttendanceStatus ? $supplyStudentDetails->externalAttendanceStatus : $studentMark->externalAttendanceStatus; | |
| if ( $request->considerRevaluation) { | |
| $revalRequest = new \stdClass(); | |
| $revalRequest->studentId = $studentId; | |
| $revalRequest->assessmentId = $studentSupplyExam->assessmentId; | |
| $revalRequest->orderByHighestMark = 1; | |
| $studentRevaluationDetails = StudentsOverAllMarkReportService::getInstance()->getStudentFinalizedRevaluationMark($revalRequest); | |
| if($studentRevaluationDetails){ | |
| $studentRevaluationDetail = current(current($studentRevaluationDetails)->students); | |
| if($studentRevaluationDetail->revaluationMark){ | |
| $studentRevaluationMark = $studentRevaluationDetail->revaluationMark; | |
| $studentSupplyExamMark = $studentRevaluationDetail->revaluationMark; | |
| $studentMark->isSupplyRevaluationMark = true; | |
| } | |
| } | |
| } | |
| if ($studentSupplyExamMark && $studentSupplyExamMark > $studentExternalMark) { | |
| $studentExternalMark = $studentSupplyExamMark; | |
| $studentMark->excludeModeration = true; | |
| } | |
| } | |
| } | |
| } | |
| $studentExamTotal = 0; | |
| $examTotal = 0; | |
| //project group marks for pg | |
| $exam->isFinalSemSubject = false; | |
| $exam->isProjectGroupSubject = false; | |
| if($courseType->isPG){ | |
| //group Project Group Subjects | |
| if($academicTermId == $lastSemId){ | |
| $exam->isFinalSemSubject = true; | |
| } | |
| // $subjectGroups = SubjectService::getInstance()->getAllSubjectGroups(); | |
| // $subGroup = "PROJECT"; | |
| // $subjectGroups = reset(array_filter($subjectGroups,function ($groupObj) use($subGroup) | |
| // { | |
| // return $groupObj->code == $subGroup; | |
| // })); | |
| // if(empty($groupSubjects[$semId])){ | |
| // $groupSubjects[$semId] = SubjectService::getInstance()->getSubjectGroupSubjectsByBatchSem($batchId, $semId, $subjectGroups->id); | |
| // } | |
| // if(!empty($groupSubjects)){ | |
| // $groupSubjectsIds = array_column($groupSubjects[$semId],'subjectId'); | |
| // if(in_array($subjectId, $groupSubjectsIds)){ | |
| // $exam->isProjectGroupSubject = true; | |
| // } | |
| // } | |
| if(in_array($academicPaperSubjectId, $request->projectSubjects)){ | |
| $exam->isProjectGroupSubject = true; | |
| } | |
| if($exam->isFinalSemSubject && $exam->isProjectGroupSubject && $student[$studentId]->groupSubjectsMarks['PROJECT']){ | |
| foreach($student[$studentId]->groupSubjectsMarks['PROJECT'] as $semGroupSubject){ | |
| $studentMark->finalSemIntMark = $studentMark->internalMark; | |
| $studentMark->projectInternalMark += $semGroupSubject->internalMark; | |
| $student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->internalMaxMark += $semGroupSubject->internalMaxMark; | |
| $student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->prevSemCredits += $semGroupSubject->credit; | |
| } | |
| } | |
| } | |
| if ( !$exam->subject->isInternal ){ | |
| $studentMark->internalMark = null; | |
| $exam->internalMaxMark = null; | |
| } | |
| if ( !$exam->subject->isExternal ){ | |
| $studentExternalMark = null; | |
| $exam->externalMaxMark = null; | |
| } | |
| if ($exam->subject->isInternal) { | |
| $studentMark->internalMark = round($studentMark->internalMark, 2); | |
| $examTotal = $exam->internalMaxMark; | |
| $studentExamTotal = $studentMark->internalMark ; | |
| if (!empty ($internalPassCriteria)) { | |
| $internalPercent = $exam->internalMaxMark ? (100 * $studentMark->internalMark/ $exam->internalMaxMark) : 0; | |
| if ( $considerOverallPassCriteriaOnly == 0 ) { | |
| $isFailed = $internalPassCriteria <= $internalPercent ? $isFailed : 1; | |
| $isInternalFailed = $internalPassCriteria <= $internalPercent ? 0 : 1; | |
| } | |
| } | |
| } | |
| $markNeededToPass = $markNeededToPassExternal = $passMark = 0; | |
| if ($exam->subject->isExternal) { | |
| $studentExternalMark = round($studentExternalMark, 2); | |
| $examTotal += $exam->externalMaxMark; | |
| $studentRequest = new \stdClass(); | |
| $studentRequest->overallPassMark = round($overallPassCriteria * (($exam->externalMaxMark + $exam->internalMaxMark) / 100), 2); | |
| if (!empty ($externalPassCriteria)) { | |
| $externalPercent = $exam->externalMaxMark ? (100 * $studentExternalMark / $exam->externalMaxMark) : 0; | |
| $externalPassMark = round($externalPassCriteria * ($exam->externalMaxMark / 100),2); | |
| if (($considerOverallPassCriteriaOnly == 0 ) && ($exam->subject->isTheory)) { | |
| $isExternalFailed = $externalPassCriteria <= $externalPercent ? 0 : 1; | |
| } | |
| } | |
| //add moderation mark if failed | |
| if ( $isExternalFailed && !$studentMark->excludeModeration) { | |
| $externalPassMark = round($externalPassCriteria * ($exam->externalMaxMark / 100), 2); | |
| $markRuleSetting->maxMark = $markRuleSetting->maxMark ? $markRuleSetting->maxMark : $exam->externalMaxMark; | |
| $moderationMark = $this->getStudentExamDetails($exam->assessmentId, $studentId, $moderationMarkDetails)->externalMark; | |
| if (!$moderationMark) { | |
| $moderationMark = $exam->maxModerationMark; | |
| } | |
| if($studentExternalMark + $moderationMark >= $externalPassMark){ | |
| $studentExternalMark = $moderationMark ? ((($studentExternalMark + $moderationMark) > $markRuleSetting->maxMark) ? $markRuleSetting->maxMark : ($studentExternalMark + $moderationMark)) : $studentExternalMark; | |
| } | |
| //limit mark to external pass mark if it exceeds by moderation mark | |
| $studentExternalMark = ($studentExternalMark > $externalPassMark) ? $externalPassMark : $studentExternalMark; | |
| //end | |
| } | |
| $studentExamTotal += $studentExternalMark; | |
| if (!empty ($externalPassCriteria)) { | |
| $externalPassMark = round($exam->externalMaxMark * ($externalPassCriteria /100),2); | |
| $externalPercent = $exam->externalMaxMark ? (100 * $studentExternalMark / $exam->externalMaxMark) : 0; | |
| if ( $considerOverallPassCriteriaOnly == 0 && ($exam->subject->isTheory) ) { | |
| $isFailed = $externalPassCriteria <= $externalPercent ? $isFailed : 1; | |
| $isExternalFailed = $externalPassCriteria <= $externalPercent ? 0 : 1; | |
| } | |
| $markNeededToPass = $markNeededToPassExternal = $isFailed ? ($externalPassMark - $studentExternalMark ): 0; | |
| } | |
| } | |
| else{ | |
| $studentExternalMark = 0; | |
| } | |
| $studentExamTotal = ceil($studentExamTotal); | |
| if (!empty ($overallPassCriteria)) { | |
| $overallPercent = $examTotal ? 100 * $studentExamTotal / $examTotal : 0; | |
| $isFailed = $overallPassCriteria <= $overallPercent ? $isFailed : 1; | |
| $overallPassMark = round($overallPassCriteria * ($examTotal / 100),2); | |
| $markNeededToPassOverAll = $isFailed ? ($overallPassMark - $studentExamTotal) : 0; | |
| if ($markNeededToPassOverAll > $markNeededToPassExternal) { | |
| $markNeededToPass = $markNeededToPassOverAll; | |
| $passMark = $overallPassMark; | |
| } | |
| } | |
| if ( $request->fetchMarkHistory ) { | |
| $studentSupplyExams = $this->getSupplyMarkHistory ($exam->subject->academicPaperSubjectId, $studentId, $supplyExamDetails); | |
| foreach ( $studentSupplyExams as $studentSupplyExam ) { | |
| $checkPassPercentCriteria->externalMark = $studentSupplyExam->mark; | |
| if ( $request->considerRevaluation) { | |
| $revalRequest = new \stdClass(); | |
| $revalRequest->studentId = $studentId; | |
| $revalRequest->assessmentId = $studentSupplyExam->assessmentId; | |
| $revalRequest->orderByHighestMark = 1; | |
| $studentSupplyExam->markObtainedInExam = round($studentSupplyExam->mark, 2) ; | |
| $studentRevaluationDetails = StudentsOverAllMarkReportService::getInstance()->getStudentFinalizedRevaluationMark($revalRequest); | |
| if($studentRevaluationDetails){ | |
| $studentRevaluationDetail = current(current($studentRevaluationDetails)->students); | |
| if($studentRevaluationDetail->revaluationMark){ | |
| $studentRevaluationMark = $studentRevaluationDetail->revaluationMark; | |
| $studentSupplyExam->markType['REVALUATION']->mark = round($studentRevaluationDetail->revaluationMark, 2); | |
| $studentSupplyExam->markType['REVALUATION']->revaluationId = $studentRevaluationDetail->revaluationId; | |
| } | |
| } | |
| $studentRevaluationMark = round($studentRevaluationMark, 2); | |
| //apply moderation to revaluation mark | |
| } | |
| // if ( $request->considerModerationMark ) { | |
| // $studentModerationMark = $this->getStudentExamDetails($studentSupplyExam->assessmentId, $studentId, $moderationMarkDetails); | |
| // if($studentModerationMark){ | |
| // $studentSupplyExam->mark += $studentModerationMark->externalMark; | |
| // $studentSupplyExam->markType['MODERATION']->mark = $studentModerationMark->externalMark; | |
| // // $markHistory["REGULAR"]->mark = $studentMark->externalMark; | |
| // } | |
| // } | |
| $studentSupplyExam->mark = $studentRevaluationMark && $studentRevaluationMark != 0? $studentRevaluationMark : round($studentSupplyExam->mark, 2) ; | |
| if ( $request->considerGraceMark ) { | |
| $studentGraceMark = $this->getStudentExamDetails($studentSupplyExam->assessmentId, $studentId, $graceMarkDetails); | |
| if($studentGraceMark){ | |
| $studentSupplyExam->mark += $studentGraceMark->externalMark; | |
| $studentSupplyExam->markType['GRACEMARK']->mark = $studentGraceMark->externalMark; | |
| } | |
| } | |
| $isSupplyFailed = $this->checkIsFailedByPassPercentCriteria ( | |
| $checkPassPercentCriteria ); | |
| $studentSupplyExam->isFailed = $isSupplyFailed; | |
| $markHistory["SUPPLY"]->supplyMarks[] = $studentSupplyExam; | |
| } | |
| $markHistory["REGULAR"]->maxMark = $examTotal; | |
| } | |
| // if ($exam->subject->isInternal && $studentMark->internalMark === null) { | |
| // $isFailed = true; | |
| // } | |
| /** | |
| * $maxGradePercent is used so that, we get the percentage in 'out of' the values in the db | |
| * ie, 6, 10 or 100, different values for different colleges for different colleges... | |
| */ | |
| if($studentMark->externalAttendanceStatus == 'ABSENT' && !(int)$exam->subject->isTheory){ | |
| $isFailed = true; | |
| } | |
| $semesterGradePercentObtained = 0; | |
| if($request->studentLowPassApplications[$studentId]->subjects[$exam->subject->academicPaperSubjectId]){ | |
| //do nothing | |
| $percentageObtained = $maxGradePercent * $studentExamTotal / $examTotal; | |
| $percentageObtained = round($percentageObtained, 2); | |
| } | |
| else if ( $isFailed ) { | |
| $percentageObtained = 0; | |
| $semesterGradePercentObtained = 0; | |
| } | |
| else { | |
| $percentageObtained = $maxGradePercent * $studentExamTotal / $examTotal; | |
| $percentageObtained = round($percentageObtained, 2); | |
| $semesterGradePercentObtained = $maxSemesterGradePercent * $studentExamTotal / $examTotal; | |
| $semesterGradePercentObtained = round($semesterGradePercentObtained, 2); | |
| } | |
| $grade = $this->getGradeByPercentage($percentageObtained, $gradeDetails); | |
| if($request->studentLowPassApplications[$studentId]->subjects[$exam->subject->academicPaperSubjectId]){ | |
| $grade->gradePoint = 4; | |
| $grade->failStatus = 0; | |
| $isFailed = 0; | |
| $grade->letterGrade = "LP"; | |
| } | |
| if (!empty ($grade)) { | |
| $creditGradePoint = ($exam->subject->credit * $grade->gradePoint); | |
| if ($grade->failStatus == 1) { | |
| $isFailed = 1; | |
| } | |
| } | |
| //normalize internal marks | |
| if(!$isFailed && $exam->subject->isInternal && $exam->subject->isExternal && $request->enableInternalNormalization){ | |
| $internalPercent = $exam->internalMaxMark ? round((100 * $studentMark->internalMark / $exam->internalMaxMark),2) : 0; | |
| if($exam->isProjectGroupSubject){ | |
| $internalPercent = $exam->internalMaxMark ? round((100 * $studentMark->internalMark / ($exam->internalMaxMark)), 2) : 0; | |
| } | |
| $externalPercent = $exam->externalMaxMark ? round((100 * $studentExternalMark / $exam->externalMaxMark),2) : 0; | |
| if($externalPercent && $internalPercent && ($internalPercent > $externalPercent) && (($internalPercent - $externalPercent) > 30)){ | |
| $normalizedInternalPercent = $externalPercent + 30; | |
| if ($exam->isProjectGroupSubject) { | |
| $internalPercent = round(($normalizedInternalPercent / 100) * ($exam->internalMaxMark),2); | |
| }else{ | |
| $normalizedInternalMark = round(($normalizedInternalPercent / 100) * $exam->internalMaxMark,2); | |
| } | |
| $studentExamTotal = ceil($studentExternalMark + $normalizedInternalMark); | |
| $percentageObtained = $maxGradePercent * $studentExamTotal / $examTotal; | |
| $percentageObtained = round($percentageObtained, 2); | |
| if (!empty($overallPassCriteria)) { | |
| $overallPercent = $examTotal ? 100 * $studentExamTotal / $examTotal : 0; | |
| $isFailed = $overallPassCriteria <= $overallPercent ? $isFailed : 1; | |
| } | |
| $grade = $this->getGradeByPercentage($percentageObtained, $gradeDetails); | |
| if (!empty ($grade)) { | |
| $creditGradePoint = ($exam->subject->credit * $grade->gradePoint); | |
| if ($grade->failStatus == 1) { | |
| $isFailed = 1; | |
| } | |
| } | |
| $studentMark->internalMark = $normalizedInternalMark; | |
| unset($normalizedInternalPercent); | |
| unset($normalizedInternalMark); | |
| } | |
| } | |
| if($exam->isFinalSemSubject && $exam->isProjectGroupSubject){ | |
| $checkPassPercentCriteriaProject = json_decode(json_encode($checkPassPercentCriteria)); | |
| $checkPassPercentCriteriaProject->internalMark += $studentMark->projectInternalMark; | |
| $checkPassPercentCriteriaProject->internalMaxMark += $student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->internalMaxMark; | |
| $projectSubjectIsFailed = $this->checkIsFailedByPassPercentCriteria ( $checkPassPercentCriteriaProject ); | |
| if($studentMark->externalAttendanceStatus == 'ABSENT' && !(int)$exam->subject->isTheory){ | |
| $projectSubjectIsFailed = true; | |
| } | |
| if ( $projectSubjectIsFailed ) { | |
| $percentageObtainedForProject = 0; | |
| } | |
| else { | |
| $percentageObtainedForProject = $maxGradePercent * ($checkPassPercentCriteriaProject->internalMark + $checkPassPercentCriteriaProject->externalMark ) / ($checkPassPercentCriteriaProject->internalMaxMark + $checkPassPercentCriteriaProject->externalMaxMark ); | |
| $percentageObtainedForProject = round($percentageObtainedForProject, 2); | |
| } | |
| $studentMark->finalSemInternalMarkProject = $checkPassPercentCriteriaProject->internalMark; | |
| $gradeProject = $this->getGradeByPercentage($percentageObtainedForProject, $gradeDetails); | |
| $studentMark->finalSemProjectCredit =($student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->prevSemCredits + $exam->subject->credit); | |
| if (!empty ($gradeProject)) { | |
| $creditGradePointProject = ( ($student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->prevSemCredits + $exam->subject->credit) * $gradeProject->gradePoint); | |
| if ($gradeProject->failStatus == 1) { | |
| $projectSubjectIsFailed = 1; | |
| } | |
| if(!$projectSubjectIsFailed && $exam->subject->isInternal && $exam->subject->isExternal && $request->enableInternalNormalization){ | |
| $internalPercentProject = $exam->internalMaxMark ? round((100 * $studentMark->internalMark / $exam->internalMaxMark),2) : 0; | |
| if($exam->isProjectGroupSubject){ | |
| $internalPercentProject = $exam->internalMaxMark ? round((100 * $checkPassPercentCriteriaProject->internalMark / ($exam->internalMaxMark + $student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->internalMaxMark)), 2) : 0; | |
| } | |
| $externalPercentProject = $exam->externalMaxMark ? round((100 * $studentExternalMark / $exam->externalMaxMark),2) : 0; | |
| if($externalPercentProject && $internalPercentProject && ($internalPercentProject > $externalPercentProject) && (($internalPercentProject - $externalPercentProject) > 30)){ | |
| $normalizedInternalPercentProject = $externalPercentProject + 30; | |
| if ($exam->isProjectGroupSubject) { | |
| $internalPercentProject = round(($normalizedInternalPercentProject / 100) * ($exam->internalMaxMark + $student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->internalMaxMark),2); | |
| }else{ | |
| $normalizedInternalMarkProject = round(($normalizedInternalPercentProject / 100) * $exam->internalMaxMark,2); | |
| } | |
| $studentExamTotalProject = ceil($studentExternalMark + $normalizedInternalMarkProject); | |
| $percentageObtainedForProject = $maxGradePercent * ($checkPassPercentCriteriaProject->internalMark + $studentExamTotalProject) / ($checkPassPercentCriteriaProject->internalMaxMark + $checkPassPercentCriteriaProject->externalMaxMark ); | |
| $percentageObtainedForProject = round($percentageObtainedForProject, 2); | |
| if (!empty($overallPassCriteria)) { | |
| $overallPercentProject = $examTotal ? 100 * ($checkPassPercentCriteriaProject->internalMark + $studentExamTotalProject) / ($checkPassPercentCriteriaProject->internalMaxMark + $checkPassPercentCriteriaProject->externalMaxMark ) : 0; | |
| $projectSubjectIsFailed = $overallPassCriteria <= $overallPercentProject ? $isFailed : 1; | |
| } | |
| $gradeProject = $this->getGradeByPercentage($percentageObtainedForProject, $gradeDetails); | |
| if (!empty ($gradeProject)) { | |
| $creditGradePointProject = (($student[$studentId]->prevSemMarks[$academicTermId]->subject[$academicPaperSubjectId]->prevSemCredits + $exam->subject->credit) * $gradeProject->gradePoint); | |
| if ($gradeProject->failStatus == 1) { | |
| $projectSubjectIsFailed = 1; | |
| } | |
| } | |
| $studentMark->finalSemInternalMarkProject = $normalizedInternalMarkProject; | |
| unset($normalizedInternalPercentProject); | |
| unset($normalizedInternalMarkProject); | |
| } | |
| } | |
| $grade->letterGrade = $gradeProject->letterGrade; | |
| $grade->gradePoint = $gradeProject->gradePoint; | |
| $creditGradePoint = $creditGradePointProject; | |
| $percentageObtained = $percentageObtainedForProject; | |
| } | |
| } | |
| if( $studentMark->moocVerificationStatus == "APPROVED"){ | |
| $grade->letterGrade = $courseType->isPG ? $grade->letterGrade :"-"; | |
| if(!$courseType->isPG){ | |
| $isFailed = 0; | |
| $isExternalFailed = 0; | |
| } | |
| } | |
| // //End normalize internal marks | |
| } // Exempted ends | |
| if($studentMark->internalAttendanceStatus == "ABSENT"){ | |
| $isFailed = 1; | |
| $isInternalFailed = 1; | |
| } | |
| $student[$studentId]->semMarks[$academicTermId]->regularExamRegId = $exam->examRegistrations->examRegistrationId; | |
| $student[$studentId]->semMarks[$academicTermId]->examRegName = $exam->examRegistrations->examRegistartionName; | |
| $student[$studentId]->semMarks[$academicTermId]->examAttendedGroupId= $exam->batch->groupId; | |
| $student[$studentId]->name = $studentMark->student->studentName; | |
| $student[$studentId]->regNo = $studentMark->student->regNo; | |
| $student[$studentId]->admissionNo = $studentMark->student->admissionNo; | |
| $student[$studentId]->studentId = $studentId; | |
| $student[$studentId]->myImage = $studentMark->student->myImage; | |
| $student[$studentId]->groupId = $studentMark->student->groupId; | |
| $student[$studentId]->batchName = $exam->batch->name; | |
| $student[$studentId]->gender = $studentMark->student->studentGender; | |
| // if( !$exam->subject->excludeSubjectFromTotal ){ For SECK college requirement | |
| $student[$studentId]->totalArrears += $isFailed; | |
| $student[$studentId]->semMarks[$academicTermId]->arrears += $isFailed; | |
| // } | |
| $student[$studentId]->batchStartYear = $exam->batch->startYear; | |
| $student[$studentId]->batchEndYear = $exam->batch->endYear ; | |
| $student[$studentId]->yearOfStudy = $exam->batch->startYear . " - " . $exam->batch->endYear ; | |
| $subject = new \stdClass(); | |
| $subject->id = $academicPaperSubjectId; | |
| $subject->subjectName = $exam->subject->subjectName; | |
| $subject->syllabusCode = $exam->subject->syllabusCode; | |
| $subject->subjectDesc = $exam->subject->subjectDesc; | |
| $subject->subjectCatId = $exam->subject->subjectCatId; | |
| $subject->subjectCatName = $exam->subject->subjectCatName; | |
| $subject->subjectCatCode = $exam->subject->subjectCatCode; | |
| $subject->categoryCode = $exam->subject->categoryCode; | |
| $subject->examAdditionalMark1 = $studentMark->examAdditionalMark1; | |
| $subject->isInternal = $exam->subject->isInternal; | |
| $subject->internalMark = round($studentMark->internalMark, 2) ; | |
| $subject->internalMaxMark = $exam->internalMaxMark; | |
| $subject->isInternalFailed = $isInternalFailed; | |
| $subject->isInternalAbsent = $studentMark->internalAttendanceStatus; | |
| $subject->internalMarkDecimal = $studentMark->internalMark; | |
| $subject->isExternal = $exam->subject->isExternal; | |
| $subject->externalMark = round($studentExternalMark, 2); | |
| $subject->externalMark2Decimal = round($studentExternalMark, 2); | |
| $subject->externalMaxMark = $exam->externalMaxMark; | |
| $subject->isExternalFailed = $isExternalFailed; | |
| $subject->internalGradePoint = $internalMarkPer; | |
| $subject->externalGradePoint = $externalMarkPer; | |
| $subject->credit = $exam->subject->credit; | |
| $subject->grade = $grade->letterGrade; | |
| $subject->maxGradePercent = $maxGradePercent; | |
| $subject->maxGradePoint = $maxGradePoint; | |
| $subject->examMonth = $examMonth; | |
| $subject->examYear = $examYear; | |
| $subject->monthYearOfPassing = $monthYearOfPassing; | |
| $subject->examRegTypeOfPassing = $examRegTypeOfPassing; | |
| $subject->examAttendedGroupId = $exam->batch->groupId; | |
| $subject->subjectOrder = (int) $exam->subject->subjectOrder; | |
| $subject->subjectPriority = (int) $exam->subject->subjectPriority; | |
| $subject->isTheory = (int) $exam->subject->isTheory; | |
| $subject->regularExamId = $exam->id; | |
| $subject->supplyAttemptCount = StudentsOverAllMarkReportService::getInstance()->getSupplyAttemptCount($studentId, $academicPaperSubjectId); | |
| $subject->internalPassCriteria = $internalPassCriteria; | |
| $subject->externalPassCriteria = $externalPassCriteria; | |
| $subject->overallPassCriteria = $overallPassCriteria; | |
| $subject->externalPassMark = $externalPassMark; | |
| $subject->overallPassMark = $overallPassMark; | |
| $subject->markNeededToPassExternal = abs($markNeededToPassExternal); | |
| $subject->markNeededToPassOverAll = abs($markNeededToPassOverAll); | |
| $subject->markNeededToPass = abs($markNeededToPass); | |
| $subject->passMark = $passMark; | |
| // isAbsent is only to know whether the student was present/absent for regular exam only | |
| $subject->isAbsent = $studentMark->externalAttendanceStatus; | |
| $subject->isFailed = $isFailed; | |
| $subject->isExempted = $isExempted; | |
| $subject->excludeSubjectFromTotal = $exam->subject->excludeSubjectFromTotal; | |
| $subject->subjectType = $exam->subject->subjectType; | |
| $subject->markHistory = $markHistory; | |
| $subject->isProjectGroupSubject = $exam->isProjectGroupSubject; | |
| $subject->isFinalSemSubject = $exam->isFinalSemSubject; | |
| $subject->projectSubjectIsFailed = $projectSubjectIsFailed; | |
| $subject->creditGradePointProject = $creditGradePointProject; | |
| $subject->percentageObtainedForProject = $percentageObtainedForProject; | |
| $subject->finalSemInternalMarkProject = $studentMark->finalSemInternalMarkProject; | |
| $subject->finalSemProjectCredit = $studentMark->finalSemProjectCredit; | |
| if($request->studentLowPassApplications[$studentId]->subjects[$exam->subject->academicPaperSubjectId]){ | |
| //setting isAbsent as 0 to handle SUPPLY applied LP students,also set month and year as same as regular exam for LP students | |
| $subject->isAbsent = "PRESENT"; | |
| $studentMark->externalAttendanceStatus = "PRESENT"; | |
| // $subject->examYear = $exam->regularExamRegistration->year; | |
| // $subject->examMonth = $exam->regularExamRegistration->month; | |
| } | |
| if($subject->isProjectGroupSubject && $subject->isFinalSemSubject){ | |
| $subject->finalSemIntMark = round($studentMark->finalSemIntMark,2); | |
| $subject->finalSemTotalMark = round(($studentExternalMark + $subject->finalSemIntMark),2); | |
| } | |
| if($subject->isProjectGroupSubject && !$subject->isFinalSemSubject){ | |
| $subject->projectCredit = getProjectCredits($batchStartYear); | |
| } | |
| if(!$subject->isFinalSemSubject && $subject->isProjectGroupSubject){ | |
| $student[$studentId]->groupSubjectsMarks['PROJECT'][$academicTermId] = clone $subject; | |
| } | |
| /** | |
| * Here 'Class' is fetched from 'semesterGrades' which is for temporary purposes | |
| * The class has to be fetched from 'subjectGrades' | |
| * A feature has to be added to examController to add ClassName in subjectGrades | |
| */ | |
| $subject->className = $grade->className; | |
| // $subject->className = $this->getGradeByPercentage($semesterGradePercentObtained, $semesterGradeDetails)->className; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId] = $subject; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->academicPaperSubjectId = $academicPaperSubjectId; | |
| // max count of supply attempted in the semester | |
| if($student[$studentId]->semMarks[$academicTermId]->supplyAttemptCount < $subject->supplyAttemptCount){ | |
| $student[$studentId]->semMarks[$academicTermId]->supplyAttemptCount = $subject->supplyAttemptCount; | |
| } | |
| // max count of supply attempted in all semesters | |
| if($student[$studentId]->supplyAttemptCount < $subject->supplyAttemptCount){ | |
| $student[$studentId]->supplyAttemptCount = $subject->supplyAttemptCount; | |
| } | |
| if ( $isExempted == 1 ) { | |
| continue; | |
| } | |
| $student[$studentId]->allCredit += $exam->subject->credit; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->gradePoint = $grade->gradePoint; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->creditGradePoint = $creditGradePoint; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->totalMarkObtained = round($studentExamTotal, 2); | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->creditxMark = $exam->subject->credit * $studentExamTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->totalMaxMark = $examTotal; | |
| if ($exam->subject->excludeSubjectFromTotal == 1) { | |
| continue; | |
| } | |
| if( !$exam->subject->excludeSubjectFromTotal ){ | |
| // $student[$studentId]->semMarks[$academicTermId]->credit += $exam->subject->credit; | |
| if(!$isFailed){ | |
| $student[$studentId]->semMarks[$academicTermId]->earnedCredit += $exam->subject->credit; | |
| } | |
| // $student[$studentId]->semMarks[$academicTermId]->creditGradePoint += $creditGradePoint; | |
| // $student[$studentId]->credit += $exam->subject->credit; | |
| // $student[$studentId]->creditGradePoint += $creditGradePoint; | |
| if(($subject->isFinalSemSubject && $subject->isProjectGroupSubject) || !$subject->isProjectGroupSubject){ | |
| if($subject->isFinalSemSubject && $subject->isProjectGroupSubject){ | |
| $student[$studentId]->semMarks[$academicTermId]->creditGradePoint += $creditGradePointProject; | |
| $student[$studentId]->semMarks[$academicTermId]->credit += $subject->finalSemProjectCredit ; | |
| $student[$studentId]->allCredit += $subject->finalSemProjectCredit; | |
| $student[$studentId]->credit += $subject->finalSemProjectCredit; | |
| $student[$studentId]->creditGradePoint += $creditGradePointProject; | |
| } | |
| else{ | |
| $student[$studentId]->semMarks[$academicTermId]->creditGradePoint += $creditGradePoint; | |
| $student[$studentId]->semMarks[$academicTermId]->credit += $exam->subject->credit ; | |
| $student[$studentId]->allCredit += $exam->subject->credit; | |
| $student[$studentId]->credit += $exam->subject->credit; | |
| $student[$studentId]->creditGradePoint += $creditGradePoint; | |
| } | |
| $student[$studentId]->totalMarkObtained += $studentExamTotal; | |
| $student[$studentId]->totalMark += $examTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->totalMarks += $studentExamTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->examTotalMarks += $examTotal; | |
| } | |
| else if ( $subject->isProjectGroupSubject ){ | |
| $student[$studentId]->totalMarkObtained += $studentExamTotal; | |
| $student[$studentId]->totalMark += $examTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->totalMarks += $studentExamTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->examTotalMarks += $examTotal; | |
| } | |
| } | |
| if ( $exam->subject->excludeSubjectFromTotal != 1 ) { | |
| $totalMark = round($studentExamTotal, 2); | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->totalMark = $totalMark; | |
| $student[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]->percentage = round(100 * | |
| $totalMark / $examTotal, 2); | |
| unset ( $totalMark ); | |
| } | |
| if ($courseType->isPG == 0 && ( | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::FOUNDATION_COURSE || | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::OPEN_ELECTIVE || | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::TERM_PAPER)) { | |
| continue; | |
| } else if ($courseType->isPG == 0 && $exam->subject->excludeSubjectFromTotal == 1) { | |
| continue; | |
| } else if ($courseType->isPG == 1 && ( | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::OPEN_ELECTIVE || | |
| $exam->subject->subjectType == ExamSubjectTypeConstants::IGNITORS )) { | |
| continue; | |
| } | |
| $student[$studentId]->totalMarkObtained += $studentExamTotal; | |
| $student[$studentId]->totalMark += $examTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->totalMarks += $studentExamTotal; | |
| $student[$studentId]->semMarks[$academicTermId]->examTotalMarks += $examTotal; | |
| $student[$studentId]->creditForConvocation += $exam->subject->credit; | |
| $student[$studentId]->creditGradePointForConvocation += $creditGradePoint; | |
| } | |
| } | |
| } | |
| if ($request->fetchOnlyMark) { | |
| return $subjectMark; | |
| } | |
| foreach ($student as $studentId => $studentObj) { | |
| $totalMark = $studentObj->totalMark; | |
| $maxPercent = $semesterGradeDetails[0]->rangeTo; | |
| $totalEarnedCredits = 0; | |
| $studentObj->isFailed = false; | |
| $studentObj->isPG = $courseType->isPG; | |
| ksort($studentObj->semMarks); | |
| $studentCredits = 0; | |
| $studentCreditGradePoint = 0; | |
| foreach ($studentObj->semMarks as $actTermId => $semMark) { | |
| $semMarkGrade = null; | |
| $semIsFailed = false; | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $semMark->examAttendedGroupId; | |
| $searchRequest->academicTermId = $actTermId; | |
| $searchRequest->requestType = "SEMESTER"; | |
| $semesterGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $semesterGradeDetails = current($semesterGradeSchemeArray)->grades; | |
| $maxPercent = $semesterGradeDetails[0]->rangeTo; | |
| if ( $semMark->arrears ) { | |
| $semMark->sgpa = "0"; // Please don't update "-" | |
| $semMarkGrade = $this->getGradeByPercentage(0, $semesterGradeDetails); | |
| $semIsFailed = true; | |
| } else { | |
| /** | |
| * Semester wise aggregate percentage criteria check | |
| */ | |
| $semesterPercentage = round ( ( $semMark->examTotalMarks ? 100 * $semMark->totalMarks / $semMark->examTotalMarks : 0) , 2); | |
| if ( $courseType->isPG == 1 && $semesterPercentage < $aggregatePassCriteria ) { | |
| $studentObj->isFailed = true; | |
| $semIsFailed = true; | |
| } | |
| /** codeEnds **/ | |
| if ( !$studentObj->isFailed ) { | |
| $semMark->sgpa = $semMark->credit ? round($semMark->creditGradePoint / $semMark->credit, 2) : 0; | |
| $semMarkGrade = $this->getGradeByPercentage($semMark->sgpa, $semesterGradeDetails); | |
| } | |
| } | |
| $semMark->grade = $semMarkGrade->letterGrade; | |
| $semMark->class = $semMarkGrade->className; | |
| $totalEarnedCredits += $semMark->earnedCredit; | |
| $semMark->totalEarnedCredits += $totalEarnedCredits; | |
| $semMark->isFailed = $semIsFailed; | |
| $semCreditxMark = array_sum(array_column($semMark->subject, "creditxMark")); | |
| $semMark->WAS = $semMark->credit ? ($semCreditxMark / $semMark->credit) : 0; | |
| $semMark->rawSgpa = $semMark->credit ? ($semMark->creditGradePoint / $semMark->credit) : 0; | |
| $studentCredits += $semMark->credit; | |
| $studentCreditGradePoint += $semMark->creditGradePoint; | |
| $semMark->semesterCgpa = $studentCredits ? round($studentCreditGradePoint/ $studentCredits, 2) : 0; | |
| } | |
| if ($studentObj->totalArrears > 0) { | |
| $studentObj->isFailed = true; | |
| } | |
| /** | |
| * In 'semesterGradeDetails' the percentage cannot be always in 100. | |
| * So inorder to handle that '$maxPercent' is used. | |
| */ | |
| $studentObj->percentage = $totalMark ? ( $maxPercent * $studentObj->totalMarkObtained / $totalMark) : 0; | |
| $studentObj->percentage = round($studentObj->percentage, 2); | |
| $schemeType = current($semesterGradeDetails)->schemeType; | |
| if ($studentObj->credit) { | |
| $studentObj->cgpa = $studentObj->creditGradePoint / $studentObj->credit; | |
| if($request->considerRoundingOffCgpa){ | |
| $studentObj->cgpa = $studentObj->cgpa ? round($studentObj->cgpa,$request->roundingOffCgpaUpto) : $studentObj->cgpa; | |
| } | |
| // if ($studentObj->totalArrears > 0 || $studentObj->isFailed ) { | |
| // $percentageGrade = $this->getGradeByPercentage(0, $semesterGradeDetails); | |
| // } else { | |
| // if ( $schemeType == "CREDIT") { | |
| $percentageGrade = $this->getGradeByPercentage($studentObj->cgpa, $cgpaGradeDetails); | |
| // } | |
| // else { | |
| // $percentageGrade = $this->getGradeByPercentage($studentObj->percentage, $semesterGradeDetails); | |
| // } | |
| // } | |
| if (!empty ($percentageGrade)) { | |
| $studentObj->grade = $percentageGrade->letterGrade; | |
| $studentObj->class = $percentageGrade->className; | |
| } | |
| } | |
| } | |
| if ($request->getFailedStudentDetailsOnly){ | |
| return $failedSemMarks; | |
| } | |
| return $student; | |
| } | |
| protected function markListProcessing($request, $studentDetails, $studentRegularExamDetails) | |
| { | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $request->groupId; | |
| $searchRequest->academicTermId = $request->academicTermId; | |
| $subjectGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $reqWithoutGracemark = clone $request; | |
| $reqWithoutGracemark->considerGraceMark = false; | |
| $lastSemId = reset($studentRegularExamDetails)->batch->finalTermId; | |
| foreach ($studentDetails as $studentId => $student) { | |
| $student->consolidated->groupId = $student->groupId; | |
| $student->consolidated->studentId = $studentId; | |
| $examRegHistoryDetails = []; | |
| $studentSemHistoryDetails = null; | |
| $semHistoryArray = []; | |
| $supplyRegDetails = []; | |
| $revalutionAppliedDetails = []; | |
| $historyRequest = new ConsolidatedOverAllMarkReportRequest(); | |
| $historyRequest = clone $request; | |
| $historyRequest->considerSupplementary = false; | |
| $historyRequest->considerImprovement = false; | |
| $historyRequest->studentId = $request->studentId; | |
| // $historyRequest->groupId = $request->groupId; | |
| $historyRequest->examRegistrationType = ExamType::REGULAR; | |
| $historyRequest->requestType = ""; | |
| // $examRegHistoryDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($historyRequest); | |
| $examRegHistoryDetails = json_decode(json_encode($studentRegularExamDetails)); | |
| $studentRegularExamDetails = ''; | |
| if ( !empty ( $examRegHistoryDetails ) ) { | |
| $studentSemHistoryDetails = $this->getStudentsOverallMarkReport($historyRequest, $examRegHistoryDetails); | |
| unset($examRegHistoryDetails); | |
| $historyRequest->considerGraceMark = false; | |
| if(reset($studentSemHistoryDetails)->semMarks[$lastSemId]){ | |
| $student->hasCompletedAcademicYear = 1; | |
| $student->finalRegularExamMonth = reset($studentSemHistoryDetails)->lastExamMonth; | |
| $student->finalRegularExamYear = reset($studentSemHistoryDetails)->lastExamYear; | |
| if( !reset($studentSemHistoryDetails)->isFailed ){ | |
| $student->passingYear = reset($studentSemHistoryDetails)->lastExamYear; | |
| $student->passingMonth = reset($studentSemHistoryDetails)->lastExamMonth; | |
| $student->hasPassYearUpdated = 1; | |
| } | |
| } | |
| foreach (reset($studentSemHistoryDetails)->semMarks as $semMarkHisId => $semMarkHis) { | |
| $semHistory = new \stdClass(); | |
| $semHistory->wgp = $semMarkHis->wgp; | |
| $semHistory->creditGradePoint = $semMarkHis->creditGradePoint; | |
| $semHistory->groupId = $semMarkHis->examAttendedGroupId; | |
| $semHistory->academicTermId = $semMarkHisId; | |
| $semHistory->examRegistrationId = $semMarkHis->regularExamRegId; | |
| $semHistory->rawSgpa = $semMarkHis->rawSgpa; | |
| $semHistory->sgpa = $semMarkHis->sgpa; | |
| $semHistory->semesterCgpa = $semMarkHis->semesterCgpa; | |
| $semHistory->wgpa = $semMarkHis->wgpa ?? 0; | |
| $semHistory->class = $semMarkHis->class; | |
| $semHistory->grade = $semMarkHis->grade; | |
| $semHistory->examYear = $semMarkHis->lastExamYear; | |
| $semHistory->examMonth = $semMarkHis->lastExamMonth; | |
| $semHistory->totalMark = $semMarkHis->examTotalMarks; | |
| $semHistory->gradePoint = $semMarkHis->gradePoint ?? 0; | |
| $semHistory->markObtained = $semMarkHis->totalMarks; | |
| $semHistory->totalMarks = $semMarkHis->examTotalMarks; | |
| $semHistory->totalEarnedCredits = $semMarkHis->totalEarnedCredits; | |
| $semHistory->earnedCredit = $semMarkHis->earnedCredit; | |
| $semHistory->percentage = ($semHistory->markObtained / $semHistory->totalMarks) * 100; | |
| $semHistory->creditxMark = $semMarkHis->creditxMark; | |
| $semHistory->failedStatus = $semMarkHis->isFailed ? "FAILED" : "PASSED"; | |
| $semHistory->historyType = ExamType::REGULAR; | |
| $semHistory->withoutRevaluationsgpa = $semHistory->sgpa; | |
| $semHistory->withoutRevaluationFailedStatus = $semHistory->failedStatus; | |
| $student->semMarks[$semMarkHisId]->consolidated->markHistory[] = $semHistory; | |
| $student->semMarks[$semMarkHisId]->consolidated->regularExamMarkDetails = $semHistory; | |
| } | |
| } | |
| foreach ($request->supplyRegIdArray as $supplyReg) { | |
| $supplyHistoryRequest = new ConsolidatedOverAllMarkReportRequest(); | |
| $supplyHistoryRequest = clone $request; | |
| $supplyHistoryRequest->examRegistrationId = $supplyReg->id; | |
| $supplyHistoryRequest->examRegistrationType = ""; | |
| $supplyHistoryRequest->requestType = ""; | |
| // $supplyHistoryRequest->academicTermId = $supplyReg->academicTermId; | |
| $supplyHistoryRequest->vivaMarkArray = $student->semMarks[$supplyReg->academicTermId]->vivaMarkArray; | |
| $supplyRegDetails[$supplyReg->id] = $this->getStudentsSupplyMarkReport($supplyHistoryRequest); | |
| if (empty($supplyRegDetails[$supplyReg->id])) continue; | |
| $semMarkHis = reset($supplyRegDetails[$supplyReg->id])->overAllMarkDetails->semMarks[$supplyReg->academicTermId]; | |
| $supplySemMarkHis = reset($supplyRegDetails[$supplyReg->id])->semMarks[$supplyReg->academicTermId]; | |
| $semHistory = new \stdClass(); | |
| $semHistory->wgp = $semMarkHis->wgp; | |
| $semHistory->creditGradePoint = $supplySemMarkHis->creditGradePoint; | |
| $semHistory->groupId = $semMarkHis->examAttendedBatchId; | |
| $semHistory->academicTermId = $supplyReg->academicTermId; | |
| $semHistory->rawSgpa = $semMarkHis->rawSgpa; | |
| $semHistory->sgpa = $semMarkHis->sgpa; | |
| $semHistory->semesterCgpa = $semMarkHis->semesterCgpa; | |
| $semHistory->totalEarnedCredits = $semMarkHis->totalEarnedCredits; | |
| $semHistory->earnedCredit = $semMarkHis->earnedCredit; | |
| $semHistory->wgpa = $semMarkHis->wgpa ?? 0; | |
| $semHistory->class = $semMarkHis->class; | |
| $semHistory->grade = $semMarkHis->grade; | |
| $semHistory->examYear = $semMarkHis->lastExamYear; | |
| $semHistory->examMonth = $semMarkHis->lastExamMonth; | |
| $semHistory->totalMarks = $supplySemMarkHis->supplyTotalMaxMarks; | |
| $semHistory->gradePoint = $supplySemMarkHis->supplyGradePoint ?? 0; | |
| $semHistory->markObtained = $supplySemMarkHis->supplyTotalMarks; | |
| $semHistory->supplyMarkObtained = $supplySemMarkHis->supplyRegularTotalMarks; | |
| $semHistory->supplyGradePoint = $supplySemMarkHis->supplyRegularGradePoint; | |
| $semHistory->percentage = ($semHistory->markObtained / $semHistory->totalMarks) * 100; | |
| $semHistory->creditxMark = $supplySemMarkHis->supplyCreditxMarks; | |
| $semHistory->failedStatus = $semMarkHis->isFailed ? "FAILED" : "PASSED"; | |
| $semHistory->withoutRevaluationsgpa = $semHistory->sgpa; | |
| $semHistory->withoutRevaluationFailedStatus = $semHistory->failedStatus; | |
| $semHistory->historyType = reset($supplyRegDetails[$supplyReg->id])->examRegType; | |
| $semHistory->examRegistrationId = $supplyReg->id; | |
| $student->semMarks[$supplyReg->academicTermId]->consolidated->markHistory[] = $semHistory; | |
| } | |
| unset($request->studentRegularExamDetails); | |
| unset($request->moderationMarkDetails); | |
| unset($request->graceMarkDetails); | |
| unset($request->supplyExamDetails); | |
| unset($request->improvementExamDetails); | |
| foreach ($student->semMarks as $semId => $semMarks) { | |
| $semMarks->consolidated->groupId = $semMarks->examAttendedGroupId; | |
| $semMarks->consolidated->semId = $semId; | |
| $semMarks->consolidated->academicTermId = $semId; | |
| $semMarks->consolidated->studentId = $studentId; | |
| $semMarks->consolidated->wgpa = 0; | |
| $semGradeObject = new \stdClass(); | |
| $semGradeObject->groupId = $semMarks->consolidated->groupId; | |
| $semGradeObject->academicTermId = $semId; | |
| $semesterGradeDetials = $this->getSemesterGradeDetials($semGradeObject, ($semMarks->arrears > 0 ? 0 : round($semMarks->sgpa, 3) * 10)); | |
| foreach ($semMarks->subject as $subjectId => $subject) { | |
| $subject->consolidated->examAttendedGroupId = $subject->examAttendedGroupId; | |
| $subject->consolidated->groupId = $subject->examAttendedGroupId; | |
| $subject->consolidated->academicTermId = $semId; | |
| $subject->consolidated->academicPaperSubjectId = $subject->id; | |
| $subject->consolidated->id = $subject->id; | |
| $subject->consolidated->studentId = $studentId; | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $semMarks->consolidated->groupId; | |
| $searchRequest->academicTermId = $semId; | |
| $searchRequest->academicPaperSubjectId = $subject->id; | |
| $subjectGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $gradeDetails[$subject->id] = current($subjectGradeSchemeArray)->grades; | |
| $maxGradePercent = current($gradeDetails[$subject->id])->rangeTo; | |
| $subject->lastMonthYear = strtotime("01 $subject->monthYearOfPassing"); | |
| $subject->consolidated->totalMarks = $subject->totalMarkObtained ? $subject->totalMarkObtained : 0; | |
| $subject->consolidated->internalMark = $subject->internalMark; | |
| $subject->consolidated->isInternalNull = $subject->isInternalNull; | |
| $subject->consolidated->internalAttendanceStatus = $subject->isInternalAbsent; | |
| $subject->consolidated->percentage = $subject->percentage ? $subject->percentage : 0; | |
| $subject->consolidated->credit = $subject->credit ? $subject->credit : 0; | |
| $subject->consolidated->grade = $subject->grade ? $subject->grade : ""; | |
| $subject->consolidated->class = $subject->className ? $subject->className : ""; | |
| $subject->consolidated->gradePoint = $subject->gradePoint ? $subject->gradePoint : 0; | |
| $subject->consolidated->creditGradePoint = $subject->creditGradePoint ? $subject->creditGradePoint : 0; | |
| $subject->consolidated->noOfChancesTaken = $subject->supplyAttemptCount + 1; | |
| $internalGrade = $this->getGradeByPercentage(($subject->internalMark/$subject->internalMaxMark)*$maxGradePercent, $gradeDetails[$subjectId]); | |
| $internalGrade->gradePoint = $internalGrade->gradePoint; | |
| $subject->internalGrade = $internalGrade->letterGrade; | |
| $subject->internalGradePoint = $internalGrade->gradePoint; | |
| $subjectmarkHistory = []; | |
| foreach ($subject->markHistory as $markHistoryType => $markHistory) { | |
| if($markHistoryType == ExamType::SUPPLY || $markHistoryType == ExamType::IMPROVEMENT || $markHistoryType == ExamType::REGULAR_SPECIAL_EXAM) { | |
| foreach ($markHistory->supplyMarks as $supplyMarksHistory){ | |
| $subjectmarkHistoryObj = new \stdClass(); | |
| $subjectmarkHistoryObj->examMarkType = $markHistoryType; | |
| $subjectmarkHistoryObj->examRegId = $supplyMarksHistory->id; | |
| $subjectmarkHistoryObj->examRegistrationId = $supplyMarksHistory->id; | |
| $subjectmarkHistoryObj->assessmentId = $supplyMarksHistory->assessmentId; | |
| $subjectmarkHistoryObj->oeExamId = $supplyMarksHistory->oeExamId; | |
| if (empty($supplyRegDetails[$subjectmarkHistoryObj->examRegistrationId])) continue; | |
| $supplyRegDetail = reset($supplyRegDetails[$subjectmarkHistoryObj->examRegId])->semMarks[$semId]->subject[$subjectId]; | |
| if( $subject->isProjectGroupSubject && $subject->isFinalSemSubject){ | |
| $supplySubjectOveralldDtails = reset($supplyRegDetails[$subjectmarkHistoryObj->examRegId])->overAllMarkDetails->semMarks[$semId]->subject[$subjectId]; | |
| $supplyRegDetail->gradePoint = $supplySubjectOveralldDtails->gradePoint; | |
| $supplyRegDetail->class = $supplySubjectOveralldDtails->className; | |
| $supplyRegDetail->grade = $supplySubjectOveralldDtails->grade; | |
| $supplyRegDetail->isFailed = $supplySubjectOveralldDtails->projectSubjectIsFailed; | |
| $supplyRegDetail->projectSubjectIsFailed = $supplySubjectOveralldDtails->projectSubjectIsFailed; | |
| $supplyRegDetail->creditGradePointProject = $supplySubjectOveralldDtails->creditGradePointProject; | |
| $supplyRegDetail->percentageObtainedForProject = $supplySubjectOveralldDtails->percentageObtainedForProject; | |
| $supplyRegDetail->finalSemInternalMarkProject = $supplySubjectOveralldDtails->finalSemInternalMarkProject; | |
| $supplyRegDetail->finalSemProjectCredit = $supplySubjectOveralldDtails->finalSemProjectCredit; | |
| } | |
| $subjectmarkHistoryObj->examId = $supplyRegDetail->supplyExamId; | |
| $subjectmarkHistoryObj->externalMark = $supplyRegDetail->externalMark; | |
| $subjectmarkHistoryObj->externalMarkObtainedInExam = $supplyMarksHistory->markObtainedInExam; | |
| $subjectmarkHistoryObj->externalMaxMark = $supplyRegDetail->externalMaxMark; | |
| $externalGradePointForGradeCalc = (($subjectmarkHistoryObj->externalMark+$subject->graceMark)/$subjectmarkHistoryObj->externalMaxMark)*$maxGradePercent; | |
| $externalGrade = $this->getGradeByPercentage($externalGradePointForGradeCalc, $gradeDetails[$subjectId]); | |
| $externalGrade->gradePoint = $externalGrade->gradePoint; | |
| $subjectmarkHistoryObj->externalGrade = $externalGrade->letterGrade; | |
| $subjectmarkHistoryObj->externalGradePoint = $externalGrade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->markObtained = $supplyRegDetail->totalMark ?? 0; | |
| $subjectmarkHistoryObj->totalMark = $supplyRegDetail->totalMaxMark ?? ($subject->internalMaxMark + $subject->externalMaxMark); | |
| $subjectmarkHistoryObj->percentage = ($subjectmarkHistoryObj->markObtained/$subjectmarkHistoryObj->totalMark) * 100; | |
| $subjectmarkHistoryObj->internalMark = $supplyRegDetail->internalMark; | |
| $subjectmarkHistoryObj->isInternalNull = $subject->isInternalNull; | |
| $subjectmarkHistoryObj->internalAttendanceStatus = $supplyRegDetail->isInternalAbsent; | |
| $subjectmarkHistoryObj->internalGrade = $subject->internalGrade; | |
| $subjectmarkHistoryObj->internalGradePoint = $subject->internalGradePoint; | |
| $subjectmarkHistoryObj->isExternalFailed = $supplyRegDetail->isExternalFailed; | |
| $percentageObtainedInternal = round(($maxGradePercent * $supplyRegDetail->internalMark / $subject->internalMaxMark), 2); | |
| $percentageObtainedExternal = round(($maxGradePercent * $subjectmarkHistoryObj->externalMark / $subjectmarkHistoryObj->externalMaxMark), 2); | |
| if($student->batchStartYear > 2018 && $subject->isInternal && $subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (4 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| }else if ($subject->isInternal && $subject->isExternal) { | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (3 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| } | |
| else if ($subject->isInternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedInternal, 2) ?? 0; | |
| } | |
| else if ($subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedExternal, 2) ?? 0; | |
| } | |
| $subjectmarkHistoryObj->creditxMark = $supplyRegDetail->creditxMark; | |
| $subjectmarkHistoryObj->grade = $supplyRegDetail->grade; | |
| $subjectmarkHistoryObj->class = $supplyRegDetail->class; | |
| $subjectmarkHistoryObj->gradePoint = $supplyRegDetail->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->creditGradePoint = $subject->credit * $subjectmarkHistoryObj->gradePoint; | |
| $subjectmarkHistoryObj->percentageObtainedExternal = $percentageObtainedExternal; | |
| $subjectmarkHistoryObj->percentageObtainedInternal = $percentageObtainedInternal; | |
| $subjectmarkHistoryObj->isInternal = $subject->isInternal; | |
| $subjectmarkHistoryObj->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
| $subjectmarkHistoryObj->isProjectGroupSubject = $subject->isProjectGroupSubject; | |
| $subjectmarkHistoryObj->finalSemProjectCredit = $supplyRegDetail->finalSemProjectCredit; | |
| $subjectmarkHistoryObj->finalSemInternalMarkProject = $supplyRegDetail->finalSemInternalMarkProject; | |
| $subjectmarkHistoryObj->percentageObtainedForProject = $supplyRegDetail->percentageObtainedForProject; | |
| $subjectmarkHistoryObj->projectSubjectIsFailed = $supplyRegDetail->projectSubjectIsFailed; | |
| $subjectmarkHistoryObj->creditGradePointProject = $supplyRegDetail->creditGradePointProject; | |
| $subjectmarkHistoryObj->isFinalSemSubject = $subject->isFinalSemSubject; | |
| $subjectmarkHistoryObj->isExternal = $subject->isExternal; | |
| if( $subject->isProjectGroupSubject && $subject->isFinalSemSubject){ | |
| $subjectmarkHistoryObj->percentage = $subjectmarkHistoryObj->percentageObtainedForProject; | |
| $subjectmarkHistoryObj->creditGradePoint = $subjectmarkHistoryObj->creditGradePointProject; | |
| } | |
| $subjectmarkHistoryObj->examMonth = $supplyMarksHistory->examMonth; | |
| $subjectmarkHistoryObj->examYear = $supplyMarksHistory->examYear; | |
| $subjectmarkHistoryObj->attendanceStatus = $supplyMarksHistory->externalAttendanceStatus; | |
| $subjectmarkHistoryObj->resultStatus = $supplyRegDetail->isFailed ? "FAILED" : "PASSED"; | |
| $passMarkForMarkHistory = $subject->externalPassMark ?? ($subject->overallPassMark ?? 0); | |
| $subjectmarkHistoryObj->markNeededToPass = $supplyRegDetail->isFailed ? $passMarkForMarkHistory - $subjectmarkHistoryObj->externalMark : 0; | |
| $subjectmarkHistoryObj->markNeededToPass = abs($subjectmarkHistoryObj->markNeededToPass); | |
| $subjectmarkHistoryObj->examName = trim($supplyMarksHistory->supplyName); | |
| //for exam written mark details | |
| $regularHistory = new \stdClass(); | |
| $regularHistory->mark = $subjectmarkHistoryObj->externalMarkObtainedInExam; | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $regularHistory); | |
| $typeVariable = "externalMarkObtainedInExam"; | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| //for getting gracemark, revaluation, moderation - gradepoints and marks | |
| foreach ($supplyMarksHistory->markType as $typeKey => $subjectMarkType){ | |
| $typeVariable = ""; | |
| if($typeKey == "REVALUATION"){ | |
| $typeVariable = "revaluation"; | |
| $subjectmarkHistoryObj->hasRevaluationMark = 1; | |
| $subjectmarkHistoryObj->revaluationId = $subjectMarkType->revaluationId; | |
| } | |
| else if($typeKey == "GRACEMARK"){ | |
| $typeVariable = "graceMark"; | |
| } | |
| else if($typeKey == "MODERATION"){ | |
| $typeVariable = "moderation"; | |
| } | |
| if( $typeVariable ){ | |
| $markVar = $typeVariable."Mark"; | |
| if($typeKey == "GRACEMARK"){ | |
| $markVar = "graceMark"; | |
| } | |
| $subjectmarkHistoryObj->$markVar = $subjectMarkType->mark; | |
| if($typeKey == "GRACEMARK" || $typeKey == "MODERATION"){ | |
| $subjectMarkType->mark += $subjectmarkHistoryObj->externalMarkObtainedInExam; | |
| } | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $subjectMarkType); | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| } | |
| } | |
| if ( $subjectmarkHistoryObj->hasRevaluationMark == 1 ){ | |
| $subjectMarkType->mark = $subjectmarkHistoryObj->externalMarkObtainedInExam + $subjectmarkHistoryObj->moderationMark + $subjectmarkHistoryObj->graceMark; | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $subjectMarkType); | |
| $subjectmarkHistoryObj->withoutRevaluationMark = $subjectMarkType->mark; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->examRegId = $subjectmarkHistoryObj->examRegistrationId; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->examMonth = $subjectmarkHistoryObj->examMonth; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->examYear = $subjectmarkHistoryObj->examYear; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->revaluationId = $subjectmarkHistoryObj->revaluationId; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->semId = $semId; | |
| $typeVariable = 'withoutRevaluation'; | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->subjects[$subjectmarkHistoryObj->assessmentId] = $subjectmarkHistoryObj; | |
| } | |
| $subjectmarkHistory[] = $subjectmarkHistoryObj; | |
| } | |
| } | |
| else if($markHistoryType == ExamType::REGULAR ) { | |
| $regularExamSubjectData = reset($studentSemHistoryDetails)->semMarks[$semId]->subject[$subject->id]; | |
| // $regularExamSubjectDataWithoutGraceMark = reset($studentSemHistoryDetailsWithoutGrace)->semMarks[$semId]->subject[$subject->id]; | |
| $subjectmarkHistoryObj = new \stdClass(); | |
| $subjectmarkHistoryObj->examMarkType = $markHistoryType; | |
| $subjectmarkHistoryObj->examRegistrationId = $markHistory->examRegistrationId; | |
| $subjectmarkHistoryObj->assessmentId = $markHistory->assessmentId; | |
| $subjectmarkHistoryObj->oeExamId = $markHistory->oeExamId; | |
| $subjectmarkHistoryObj->studentAttendanceStatus = $markHistory->studentAttendanceStatus; | |
| $subjectmarkHistoryObj->externalMark = $regularExamSubjectData->externalMark; | |
| $subjectmarkHistoryObj->externalMarkObtainedInExam = $markHistory->markObtainedInExam; | |
| $subjectmarkHistoryObj->externalMaxMark = $subject->externalMaxMark; | |
| $externalGradePointForGradeCalc = (($subjectmarkHistoryObj->externalMark+$subject->graceMark)/$subjectmarkHistoryObj->externalMaxMark)*$maxGradePercent; | |
| $externalGrade = $this->getGradeByPercentage($externalGradePointForGradeCalc, $gradeDetails[$subjectId]); | |
| $externalGrade->gradePoint = $externalGrade->gradePoint; | |
| $subjectmarkHistoryObj->externalGrade = $externalGrade->letterGrade; | |
| $subjectmarkHistoryObj->externalGradePoint = $externalGrade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->markObtained = $regularExamSubjectData->totalMarkObtained; | |
| $subjectmarkHistoryObj->totalMark = $subject->internalMaxMark + $subject->externalMaxMark; | |
| $subjectmarkHistoryObj->percentage = ($subjectmarkHistoryObj->markObtained/$subjectmarkHistoryObj->totalMark) * 100; | |
| $subjectmarkHistoryObj->internalMark = $regularExamSubjectData->internalMark; | |
| $subjectmarkHistoryObj->isInternalNull = $subject->isInternalNull; | |
| $subjectmarkHistoryObj->internalAttendanceStatus = $regularExamSubjectData->isInternalAbsent; | |
| $subjectmarkHistoryObj->internalGrade = $subject->internalGrade; | |
| $subjectmarkHistoryObj->internalGradePoint = $subject->internalGradePoint; | |
| $subjectmarkHistoryObj->isExternalFailed = $regularExamSubjectData->isExternalFailed; | |
| $percentageObtainedInternal = round(($maxGradePercent * $regularExamSubjectData->internalMark / $subject->internalMaxMark), 2); | |
| $percentageObtainedExternal = round(($maxGradePercent * $subjectmarkHistoryObj->externalMark / $subjectmarkHistoryObj->externalMaxMark), 2); | |
| if($student->batchStartYear > 2018 && $subject->isInternal && $subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (4 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| }else if ($subject->isInternal && $subject->isExternal) { | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (3 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| } | |
| else if ($subject->isInternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedInternal, 2) ?? 0; | |
| } | |
| else if ($subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedExternal, 2) ?? 0; | |
| } | |
| $grade = $this->getGradeByPercentage($subjectmarkHistoryObj->percentage * $maxGradePercent/100, $gradeDetails[$subjectId]); | |
| $grade->gradePoint = $regularExamSubjectData->gradePoint; | |
| $subjectmarkHistoryObj->creditxMark = $subject->credit * $subjectmarkHistoryObj->markObtained; | |
| $subjectmarkHistoryObj->grade = $regularExamSubjectData->grade; | |
| $subjectmarkHistoryObj->class = $regularExamSubjectData->className; | |
| $subjectmarkHistoryObj->percentageObtainedExternal = $percentageObtainedExternal; | |
| $subjectmarkHistoryObj->percentageObtainedInternal = $percentageObtainedInternal; | |
| $subjectmarkHistoryObj->gradePoint = $grade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->creditGradePoint = $subject->credit * $subjectmarkHistoryObj->gradePoint ; | |
| $subjectmarkHistoryObj->examMonth = $markHistory->month; | |
| $subjectmarkHistoryObj->examYear = $markHistory->year; | |
| $subjectmarkHistoryObj->attendanceStatus = $markHistory->externalAttendanceStatus; | |
| $subjectmarkHistoryObj->resultStatus = $regularExamSubjectData->isFailed ? "FAILED" : "PASSED"; | |
| // $subjectmarkHistoryObj->resultStatusWithoutGraceMark = $regularExamSubjectDataWithoutGraceMark->isFailed ? "FAILED" : "PASSED"; | |
| $subjectmarkHistoryObj->markNeededToPass = $regularExamSubjectData->isFailed ? $regularExamSubjectData->markNeededToPass : 0; | |
| // $subjectmarkHistoryObj->markNeededToPassWithoutGraceMark = $regularExamSubjectDataWithoutGraceMark->isFailed ? $regularExamSubjectDataWithoutGraceMark->markNeededToPass : 0; | |
| $subjectmarkHistoryObj->markNeededToPassExternal = $regularExamSubjectData->isExternalFailed ? $regularExamSubjectData->markNeededToPassExternal : 0; | |
| $subjectmarkHistoryObj->markNeededToPassOverAll = $regularExamSubjectData->isFailed ? $regularExamSubjectData->markNeededToPassOverAll : 0; | |
| $subjectmarkHistoryObj->isInternal = $subject->isInternal; | |
| $subjectmarkHistoryObj->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
| $subjectmarkHistoryObj->isProjectGroupSubject = $regularExamSubjectData->isProjectGroupSubject; | |
| $subjectmarkHistoryObj->finalSemProjectCredit = $regularExamSubjectData->finalSemProjectCredit; | |
| $regularExamSubjectData->finalSemInternalMarkProject = $subject->finalSemInternalMarkProject; | |
| $subjectmarkHistoryObj->percentageObtainedForProject = $regularExamSubjectData->percentageObtainedForProject; | |
| $subjectmarkHistoryObj->projectSubjectIsFailed = $regularExamSubjectData->projectSubjectIsFailed; | |
| $subjectmarkHistoryObj->creditGradePointProject = $regularExamSubjectData->creditGradePointProject; | |
| $subjectmarkHistoryObj->isFinalSemSubject = $subject->isFinalSemSubject; | |
| $subjectmarkHistoryObj->isExternal = $subject->isExternal; | |
| if( $regularExamSubjectData->isProjectGroupSubject && $subject->isFinalSemSubject){ | |
| $subjectmarkHistoryObj->percentage = $subjectmarkHistoryObj->percentageObtainedForProject; | |
| $subjectmarkHistoryObj->creditGradePoint = $subjectmarkHistoryObj->creditGradePointProject; | |
| } | |
| $subjectmarkHistoryObj->examName = trim($markHistory->name); | |
| //for exam written mark details | |
| $regularHistory = new \stdClass(); | |
| $regularHistory->mark = $subjectmarkHistoryObj->externalMarkObtainedInExam; | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $regularHistory); | |
| $typeVariable = "externalMarkObtainedInExam"; | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| //for getting gracemark, revaluation, moderation - gradepoints and marks | |
| foreach ($markHistory->markType as $typeKey => $subjectMarkType){ | |
| $typeVariable = ""; | |
| if($typeKey == "REVALUATION"){ | |
| $typeVariable = "revaluation"; | |
| $subjectmarkHistoryObj->hasRevaluationMark = 1; | |
| $subjectmarkHistoryObj->revaluationId = $subjectMarkType->revaluationId; | |
| } | |
| else if($typeKey == "GRACEMARK"){ | |
| $typeVariable = "graceMark"; | |
| } | |
| else if($typeKey == "MODERATION"){ | |
| $typeVariable = "moderation"; | |
| } | |
| if( $typeVariable ){ | |
| $markVar = $typeVariable."Mark"; | |
| if($typeKey == "GRACEMARK"){ | |
| $markVar = "graceMark"; | |
| } | |
| $subjectmarkHistoryObj->$markVar = $subjectMarkType->mark; | |
| if($typeKey == "GRACEMARK" || $typeKey == "MODERATION"){ | |
| $subjectMarkType->mark += $subjectmarkHistoryObj->externalMarkObtainedInExam; | |
| } | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $subjectMarkType); | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| } | |
| } | |
| if ( $subjectmarkHistoryObj->hasRevaluationMark == 1 ){ | |
| $subjectMarkType->mark = $subjectmarkHistoryObj->externalMarkObtainedInExam + $subjectmarkHistoryObj->moderationMark + $subjectmarkHistoryObj->graceMark; | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $subjectMarkType); | |
| $subjectmarkHistoryObj->withoutRevaluationMark = $subjectMarkType->mark; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->examRegId = $subjectmarkHistoryObj->examRegistrationId; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->examMonth = $subjectmarkHistoryObj->examMonth; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->examYear = $subjectmarkHistoryObj->examYear; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->semId = $semId; | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->revaluationId = $subjectmarkHistoryObj->revaluationId; | |
| $typeVariable = 'withoutRevaluation'; | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| $revalutionAppliedDetails[$subjectmarkHistoryObj->examRegistrationId]->subjects[$subjectmarkHistoryObj->assessmentId] = $subjectmarkHistoryObj; | |
| } | |
| $subjectmarkHistory[] = $subjectmarkHistoryObj; | |
| } | |
| else { | |
| $subjectmarkHistoryObj = new \stdClass(); | |
| $subjectmarkHistoryObj->examMarkType = $markHistoryType; | |
| $subjectmarkHistoryObj->examRegId = $markHistory->examRegId; | |
| $subjectmarkHistoryObj->examId = $markHistory->examId; | |
| $subjectmarkHistoryObj->externalMark = $markHistory->mark; | |
| $subjectmarkHistoryObj->externalMaxMark = $subject->externalMaxMark; | |
| $subjectmarkHistoryObj->internalMark = $subject->internalMark; | |
| $subjectmarkHistoryObj->isInternalNull = $subject->isInternalNull; | |
| $subjectmarkHistoryObj->internalAttendanceStatus = $subject->isInternalAbsent; | |
| $subjectmarkHistoryObj->internalGrade = $subject->internalGrade; | |
| $subjectmarkHistoryObj->internalGradePoint = $subject->internalGradePoint; | |
| $externalGrade = $this->getGradeByPercentage((($subjectmarkHistoryObj->externalMark+$subject->graceMark)/$subjectmarkHistoryObj->externalMaxMark)*$maxGradePercent, $gradeDetails[$subjectId]); | |
| $externalGrade->gradePoint = $externalGrade->gradePoint; | |
| $subjectmarkHistoryObj->externalGrade = $externalGrade->letterGrade; | |
| $subjectmarkHistoryObj->externalGradePoint = $externalGrade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->markObtained = $subjectmarkHistoryObj->externalMark+$subject->graceMark; | |
| $subjectmarkHistoryObj->totalMark = $subject->internalMaxMark + $subject->externalMaxMark; | |
| $subjectmarkHistoryObj->percentage = ($subjectmarkHistoryObj->markObtained/$subjectmarkHistoryObj->totalMark) * 100; | |
| $percentageObtainedInternal = round(($maxGradePercent * $subject->internalMark / $subject->internalMaxMark), 2); | |
| $percentageObtainedExternal = round(($maxGradePercent * $subjectmarkHistoryObj->externalMark / $subjectmarkHistoryObj->externalMaxMark), 2); | |
| if($student->batchStartYear > 2018 && $subject->isInternal && $subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (4 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| }else if ($subject->isInternal && $subject->isExternal) { | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (3 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| } | |
| else if ($subject->isInternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedInternal, 2) ?? 0; | |
| } | |
| else if ($subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedExternal, 2) ?? 0; | |
| } | |
| $grade = $this->getGradeByPercentage($subjectmarkHistoryObj->percentage * $maxGradePercent/100, $gradeDetails[$subjectId]); | |
| $subjectmarkHistoryObj->creditxMark = $subject->credit * $subjectmarkHistoryObj->markObtained; | |
| $subjectmarkHistoryObj->grade = $grade->letterGrade; | |
| $subjectmarkHistoryObj->class = $grade->className; | |
| $subjectmarkHistoryObj->percentageObtainedExternal = $percentageObtainedExternal; | |
| $subjectmarkHistoryObj->percentageObtainedInternal = $percentageObtainedInternal; | |
| $subjectmarkHistoryObj->gradePoint = $grade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->creditGradePoint = $subject->credit * $subjectmarkHistoryObj->gradePoint ; | |
| $subjectmarkHistoryObj->examMonth = $markHistory->month; | |
| $subjectmarkHistoryObj->examYear = $markHistory->year; | |
| $subjectmarkHistoryObj->attendanceStatus = $markHistory->externalAttendanceStatus; | |
| $subjectmarkHistoryObj->resultStatus = $markHistory->isFailed ? "FAILED" : "PASSED"; | |
| $subjectmarkHistoryObj->markNeededToPass = $markHistory->isFailed ? $subject->externalPassMark - $subjectmarkHistoryObj->externalMark : 0; | |
| $subjectmarkHistoryObj->markNeededToPass = abs($subjectmarkHistoryObj->markNeededToPass); | |
| $subjectmarkHistoryObj->examName = trim($markHistory->name); | |
| $subjectmarkHistoryObj->isInternal = $subject->isInternal; | |
| $subjectmarkHistoryObj->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
| $subjectmarkHistoryObj->isProjectGroupSubject = $subject->isProjectGroupSubject; | |
| $subjectmarkHistoryObj->finalSemProjectCredit = $subject->finalSemProjectCredit; | |
| $subjectmarkHistoryObj->finalSemInternalMarkProject = $subject->finalSemInternalMarkProject; | |
| $subjectmarkHistoryObj->percentageObtainedForProject = $subject->percentageObtainedForProject; | |
| $subjectmarkHistoryObj->projectSubjectIsFailed = $subject->projectSubjectIsFailed; | |
| $subjectmarkHistoryObj->creditGradePointProject = $subject->creditGradePointProject; | |
| $subjectmarkHistoryObj->isFinalSemSubject = $subject->isFinalSemSubject; | |
| $subjectmarkHistoryObj->isExternal = $subject->isExternal; | |
| $subjectmarkHistory[] = $subjectmarkHistoryObj; | |
| } | |
| } | |
| $subject->consolidated->markHistory = $subjectmarkHistory; | |
| $subject->consolidated->status = $subject->isFailed ? "FAILED" : "PASSED"; | |
| $subjectMarkDetails = new \stdClass(); | |
| $subjectMarkDetails->code = $subject->subjectName; | |
| $subjectMarkDetails->syllabusCode = $subject->syllabusCode; | |
| $subjectMarkDetails->priority = $subject->subjectPriority; | |
| $subjectMarkDetails->categoryId = $subject->subjectCatId; | |
| $subjectMarkDetails->categoryName = $subject->subjectCatName; | |
| $subjectMarkDetails->categoryCode = $subject->subjectCatCode; | |
| $subjectMarkDetails->isInternal = $subject->isInternal; | |
| $subjectMarkDetails->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
| $subjectMarkDetails->isProjectGroupSubject = $subject->isProjectGroupSubject; | |
| $subjectMarkDetails->finalSemProjectCredit = $subject->finalSemProjectCredit; | |
| $subjectMarkDetails->finalSemInternalMarkProject = $subject->finalSemInternalMarkProject; | |
| $subjectMarkDetails->creditGradePointProject = $subject->creditGradePointProject; | |
| $subjectMarkDetails->percentageObtainedForProject = $subject->percentageObtainedForProject; | |
| $subjectMarkDetails->projectSubjectIsFailed = $subject->projectSubjectIsFailed; | |
| $subjectMarkDetails->isFinalSemSubject = $subject->isFinalSemSubject; | |
| $subjectMarkDetails->internalMark = $subject->internalMark; | |
| $subjectMarkDetails->isInternalNull = $subject->isInternalNull; | |
| $subjectMarkDetails->internalAttendanceStatus = $subject->isInternalAbsent; | |
| $subjectMarkDetails->internalMaxMark = $subject->internalMaxMark; | |
| $subjectMarkDetails->graceMark = $subject->graceMark; | |
| $subjectMarkDetails->internalGrade = $subject->letterGrade; | |
| $subjectMarkDetails->internalGradePoint = $subject->gradePoint; | |
| $subjectMarkDetails->isInternalFailed = $subject->isInternalFailed; | |
| $subjectMarkDetails->internalAttendance = $subject->isInternalAbsent; | |
| $subjectMarkDetails->isExternal = $subject->isExternal; | |
| $subjectMarkDetails->externalMark = $subject->externalMark; | |
| $subjectMarkDetails->externalMaxMark = $subject->externalMaxMark; | |
| $externalGrade = $this->getGradeByPercentage(($subjectMarkDetails->externalMark/$subjectMarkDetails->externalMaxMark)*$maxGradePercent, $gradeDetails[$subjectId]); | |
| $externalGrade->gradePoint = $externalGrade->gradePoint; | |
| $subjectMarkDetails->externalGrade = $externalGrade->letterGrade; | |
| $subjectMarkDetails->externalGradePoint = $externalGrade->gradePoint; | |
| $subjectMarkDetails->isExternalFailed = $subject->isExternalFailed; | |
| $subjectMarkDetails->maxGradePercent = $subject->maxGradePercent; | |
| $subjectMarkDetails->maxGradePoint = $subject->maxGradePoint; | |
| $subjectMarkDetails->examMonth = $subject->examMonth; | |
| $subjectMarkDetails->examYear = $subject->examYear; | |
| $subjectMarkDetails->monthYearOfPassing = $subject->monthYearOfPassing; | |
| $subjectMarkDetails->isTheory = $subject->isTheory; | |
| $subjectMarkDetails->supplyAttemptCount = $subject->supplyAttemptCount; | |
| $subjectMarkDetails->credit = $subject->credit; | |
| $subjectMarkDetails->creditGradePoint = $subject->creditGradePoint; | |
| $subjectMarkDetails->markNeededToPass = abs($subject->markNeededToPass); | |
| $subjectMarkDetails->gradePoint = $subject->gradePoint; | |
| $percentageObtainedInternal = round(($maxGradePercent * $subject->internalMark / $subject->internalMaxMark), 2); | |
| $percentageObtainedExternal = round(($maxGradePercent * ($subjectMarkDetails->externalMark + $subject->graceMark) / $subjectMarkDetails->externalMaxMark), 2); | |
| if($student->batchStartYear > 2018 && $subject->isInternal && $subject->isExternal){ | |
| $subjectMarkDetails->wgpa = ($percentageObtainedInternal + (4 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectMarkDetails->wgpa = round($subjectMarkDetails->wgpa, 2) ?? 0; | |
| }else if ($subject->isInternal && $subject->isExternal) { | |
| $subjectMarkDetails->wgpa = ($percentageObtainedInternal + (3 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectMarkDetails->wgpa = round($subjectMarkDetails->wgpa, 2) ?? 0; | |
| } | |
| else if ($subject->isInternal){ | |
| $subjectMarkDetails->wgpa = round($percentageObtainedInternal, 2) ?? 0; | |
| } | |
| else if ($subject->isExternal){ | |
| $subjectMarkDetails->wgpa = round($percentageObtainedExternal, 2) ?? 0; | |
| } | |
| $subjectMarkDetails->grade = $subject->grade; | |
| $subjectMarkDetails->class = $subject->className ? $subject->className : ""; | |
| $subjectMarkDetails->creditxMark = $subject->creditxMark; | |
| $subjectMarkDetails->markObtained = $subject->totalMark; | |
| $subjectMarkDetails->totalMarks = $subject->totalMaxMark; | |
| $subjectMarkDetails->isFailed = $subject->isFailed; | |
| $subjectMarkDetails->percentageObtainedExternal = $percentageObtainedExternal; | |
| $subjectMarkDetails->percentageObtainedInternal = $percentageObtainedInternal; | |
| $subjectMarkDetails->internalPassPercentage = $subject->internalPassCriteria; | |
| $subjectMarkDetails->externalPassPercentage = $subject->externalPassCriteria; | |
| $subjectMarkDetails->aggregatePassPercentage = $subject->overallPassCriteria; | |
| $subjectMarkDetails->attendance = $subject->externalAttendanceStatus; | |
| $subjectMarkDetails->latestExamYear = date("Y",strtotime("01 $subject->monthYearOfPassing")); | |
| $subjectMarkDetails->latestExamMonth = date("m",strtotime("01 $subject->monthYearOfPassing")); | |
| $subjectMarkDetails->latestExamType = $subject->examRegTypeOfPassing; | |
| $subjectMarkDetails->attendanceStatus = $subject->isAbsent ; | |
| $subjectMarkDetails->internalMark = $subject->internalMark; | |
| $subjectMarkDetails->internalMaxMark = $subject->internalMaxMark; | |
| $subjectMarkDetails->internalResultStatus = $subject->isInternalFailed ? "FAILED" : "PASSED"; | |
| $subjectMarkDetails->externalMark = $subject->externalMark; | |
| $subjectMarkDetails->externalMaxMark = $subject->externalMaxMark; | |
| $subjectMarkDetails->externalResultStatus = $subject->isExternalFailed ? "FAILED" : "PASSED"; | |
| $subjectMarkDetails->maxGradePoint = $subject->maxGradePoint; | |
| $subjectMarkDetails->maxGradePercentage = $subject->maxGradePercent; | |
| $subject->consolidated->markDetails = $subjectMarkDetails; | |
| $semMarks->consolidated->wgpa += $subjectMarkDetails->wgpa; | |
| } | |
| $totalCreditxGradePoint = array_sum(array_column($semMarks->subject,'creditGradePoint')); | |
| // $semMarks->sgpa = $totalCreditxGradePoint / $semMarks->credit; | |
| // $semMarks->creditGradePoint = $totalCreditxGradePoint; | |
| $semGradeObject = new \stdClass(); | |
| $semGradeObject->groupId = $semMarks->examAttendedGroupId; | |
| $semGradeObject->academicTermId = $semId; | |
| $semesterGradeDetials = $this->getSemesterGradeDetials($semGradeObject, round(($semMarks->isFailed ? 0 : $semMarks->sgpa), 2)); | |
| $semMarks->grade = $semesterGradeDetials->letterGrade; | |
| $semMarks->class = $semesterGradeDetials->className; | |
| $semMarks->consolidated->noOfArrears = $semMarks->arrears ? $semMarks->arrears : 0; | |
| $semMarks->consolidated->supplyAttemptCount = $semMarks->supplyAttemptCount ? $semMarks->supplyAttemptCount : 0; | |
| $semMarks->consolidated->totalMarks = $semMarks->totalMarks ? $semMarks->totalMarks : 0; | |
| $semMarks->consolidated->percentage = ($semMarks->totalMarks / $semMarks->examTotalMarks) * 100; | |
| $semMarks->consolidated->grade = $semMarks->grade ? $semMarks->grade : ""; | |
| $semMarks->consolidated->class = $semMarks->class ? $semMarks->class : ""; | |
| $semMarks->consolidated->sgpa = round($semMarks->sgpa, 2); | |
| // without Gracemark | |
| $semMarks->consolidated->sgpaWithoutGracemark = $studentDetailsWithoutGracemark->batchStartYear > 2018 ? round($studentDetailsWithoutGracemark->semMarks[$semId]->sgpa, 3) : round($studentDetailsWithoutGracemark->semMarks[$semId]->sgpa, 2); | |
| $semMarks->consolidated->rawSgpaWithoutGracemark = $studentDetailsWithoutGracemark->semMarks[$semId]->rawSgpa; | |
| $semMarks->consolidated->rawSgpa = $semMarks->rawSgpa; | |
| $semMarks->consolidated->semesterCgpa = $semMarks->semesterCgpa; | |
| $semMarks->consolidated->status = $semMarks->isFailed ? "FAILED" : "PASSED"; | |
| $semMarkDetails = new \stdClass(); | |
| $semMarkDetails->noOfChancesTaken = max(array_column(array_column($semMarks->subject,"consolidated"),"noOfChancesTaken")); | |
| $semMarkDetails->totalEarnedCredits = $semMarks->totalEarnedCredits; | |
| $semMarkDetails->id = $semMarks->consolidated->academicTermId; | |
| $semMarkDetails->name = $semMarks->semName; | |
| $semMarkDetails->credit = $semMarks->credit; | |
| $semMarkDetails->creditGradePoint = $semMarks->creditGradePoint; | |
| $semMarkDetails->latestExamMonth = $semMarks->lastExamMonth; | |
| $semMarkDetails->latestExamYear = $semMarks->lastExamYear; | |
| $semMarkDetails->latestExamType = $semMarks->lastExamReg; | |
| $semMarkDetails->arrearCount = $semMarks->consolidated->noOfArrears; | |
| $semMarkDetails->supplyAttemptCount = $semMarks->consolidated->supplyAttemptCount; | |
| $semMarkDetails->sgpa = $semMarks->consolidated->sgpa; | |
| $semMarkDetails->rawSgpa = $semMarks->consolidated->rawSgpa; | |
| $semMarkDetails->semesterCgpa = $semMarks->consolidated->semesterCgpa; | |
| $semMarkDetails->wgpa = $semMarks->consolidated->wgpa ?? 0; | |
| $semMarkDetails->gradePoint = $semMarks->gradePoint; | |
| $semMarkDetails->grade = $semMarks->consolidated->grade; | |
| $semMarkDetails->class = $semMarks->consolidated->class; | |
| $semMarkDetails->percentage = $semMarks->consolidated->percentage; | |
| $semMarkDetails->creditxMark = $semMarks->creditxMark; | |
| $semMarkDetails->markObtained = $semMarks->totalMarks; | |
| $semMarkDetails->totalMarks = $semMarks->examTotalMarks; | |
| $semMarkDetails->passPercentage = $student->aggregatePassCriteria; | |
| $semMarkDetails->isFailed = $semMarks->isFailed; | |
| $semMarks->consolidated->markDetails = $semMarkDetails; | |
| } | |
| /***********************for handling revaluation publish*********************************/ | |
| if ( $revalutionAppliedDetails ){ | |
| foreach( $revalutionAppliedDetails as $revalutionExamObject ){ | |
| $semesterMarksCopy = json_decode(json_encode($student->semMarks[$revalutionExamObject->semId], JSON_PARTIAL_OUTPUT_ON_ERROR)); | |
| $withoutRevaluationResponse = $this->recalculateForExceptionalCase($semesterMarksCopy->subject, $revalutionExamObject); | |
| $semesterMarksCopy->withoutRevaluationsgpa = $semesterMarksCopy->credit ? round($withoutRevaluationResponse->earnedCreditPoint / $semesterMarksCopy->credit, 2) : 0; | |
| foreach( $student->semMarks[$revalutionExamObject->semId]->consolidated->markHistory as $semCurrentHistory ){ | |
| if( $semCurrentHistory->examRegistrationId == $revalutionExamObject->examRegId){ | |
| $semCurrentHistory->withoutRevaluationsgpa = $semesterMarksCopy->withoutRevaluationsgpa; | |
| $semCurrentHistory->withoutRevaluationFailedStatus = $withoutRevaluationResponse->isFailed == 1 ? 'FAILED' : 'PASSED' ; | |
| $semCurrentHistory->hasRevaluationMark = 1; | |
| $semCurrentHistory->revaluationId = $revalutionExamObject->revaluationId; | |
| } | |
| } | |
| } | |
| } | |
| unset($supplyRegDetails); | |
| unset($revalutionAppliedDetails); | |
| unset($studentSemHistoryDetails); | |
| /****************************************************************************************/ | |
| /***********************for minor honor case*********************************/ | |
| $minorRequest = new ConsolidatedOverAllMarkReportRequest(); | |
| $minorRequest->isConsolidatedRequest = TRUE; | |
| $minorRequest->examRegistrationType = "REGULAR"; | |
| $minorRequest->isRoundOff = 1; | |
| $minorRequest->studentId = $studentId; | |
| $minorRequest->considerSupplementary = false; | |
| $minorRequest->considerImprovement = false; | |
| $minorRequest->considerMinorSubject = true; | |
| $request->fetchMarkHistory = 1; | |
| $studentMinorExamDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($minorRequest); | |
| $minorRequest->moderationMarkDetails = []; | |
| if ( $request->considerModerationMark ) { | |
| $minorRequest->examRegistrationType = ""; | |
| $minorRequest->requestType = "MODERATION"; | |
| $minorRequest->moderationMarkDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($minorRequest); | |
| } | |
| $minorStudentDetails = []; | |
| if($studentMinorExamDetails){ | |
| $minorStudentDetails = $this->getStudentsOverallMarkReport($minorRequest, $studentMinorExamDetails); | |
| unset($studentMinorExamDetails); | |
| } | |
| $minorStudentDetails = !empty($minorStudentDetails) ? $minorStudentDetails : []; | |
| $honorRequest = new ConsolidatedOverAllMarkReportRequest(); | |
| $honorRequest->isConsolidatedRequest = TRUE; | |
| $honorRequest->examRegistrationType = "REGULAR"; | |
| $honorRequest->isRoundOff = 1; | |
| $honorRequest->studentId = $studentId; | |
| $honorRequest->considerSupplementary = false; | |
| $honorRequest->considerImprovement = false; | |
| $honorRequest->considerHonorSubject = true; | |
| $request->fetchMarkHistory = 1; | |
| $studentHonorExamDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($honorRequest); | |
| $honorStudentDetails = []; | |
| $honorRequest->moderationMarkDetails = []; | |
| if ( $request->considerModerationMark ) { | |
| $honorRequest->examRegistrationType = ""; | |
| $honorRequest->requestType = "MODERATION"; | |
| $honorRequest->moderationMarkDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($minorRequest); | |
| } | |
| if($studentHonorExamDetails){ | |
| $honorStudentDetails = $this->getStudentsOverallMarkReport($honorRequest, $studentHonorExamDetails); | |
| unset($studentHonorExamDetails); | |
| } | |
| $honorStudentDetails = !empty($honorStudentDetails) ? $honorStudentDetails : []; | |
| $minorHonorStudentDetails = array_merge($minorStudentDetails, $honorStudentDetails); | |
| unset($minorStudentDetails); | |
| unset($honorStudentDetails); | |
| foreach ( $minorHonorStudentDetails as $minorStudentId => $minorStudent) { | |
| foreach ($minorStudent->semMarks as $minorStudentTermId => $minorSemHistory) { | |
| $semHistory = new \stdClass(); | |
| $semHistory->wgp = $minorSemHistory->wgp; | |
| $semHistory->creditGradePoint = $minorSemHistory->creditGradePoint; | |
| $semHistory->groupId = $minorSemHistory->examAttendedGroupId; | |
| $semHistory->academicTermId = $minorStudentTermId; | |
| $semHistory->examRegistrationId = $minorSemHistory->regularExamRegId; | |
| $semHistory->rawSgpa = $minorSemHistory->rawSgpa; | |
| $semHistory->sgpa = $minorSemHistory->sgpa; | |
| $semHistory->semesterCgpa = $minorSemHistory->semesterCgpa; | |
| $semHistory->wgpa = $minorSemHistory->wgpa ?? 0; | |
| $semHistory->class = $minorSemHistory->class; | |
| $semHistory->grade = $minorSemHistory->grade; | |
| $semHistory->examYear = $minorSemHistory->lastExamYear; | |
| $semHistory->examMonth = $minorSemHistory->lastExamMonth; | |
| $semHistory->totalMark = $minorSemHistory->examTotalMarks; | |
| $semHistory->gradePoint = $minorSemHistory->gradePoint ?? 0; | |
| $semHistory->markObtained = $minorSemHistory->totalMarks; | |
| $semHistory->totalMarks = $minorSemHistory->examTotalMarks; | |
| $semHistory->totalEarnedCredits = $minorSemHistory->totalEarnedCredits; | |
| $semHistory->earnedCredit = $minorSemHistory->earnedCredit; | |
| $semHistory->percentage = ($semHistory->markObtained / $semHistory->totalMarks) * 100; | |
| $semHistory->creditxMark = $minorSemHistory->creditxMark; | |
| $semHistory->failedStatus = $minorSemHistory->isFailed ? "FAILED" : "PASSED"; | |
| $semHistory->historyType = ExamType::REGULAR; | |
| $student->semMarks[$minorStudentTermId]->consolidated->markHistory[] = $semHistory; | |
| $semGradeObject = new \stdClass(); | |
| $semGradeObject->groupId = $minorSemHistory->examAttendedGroupId; | |
| $semGradeObject->academicTermId = $minorStudentTermId; | |
| $semesterGradeDetials = $this->getSemesterGradeDetials($semGradeObject, ($minorSemHistory->arrears > 0 ? 0 : round($minorSemHistory->sgpa, 3) * 10)); | |
| foreach ($minorSemHistory->subject as $subjectId => $subject) { | |
| $subject->consolidated->examAttendedGroupId = $subject->examAttendedGroupId; | |
| $subject->consolidated->groupId = $subject->examAttendedGroupId; | |
| $subject->consolidated->academicTermId = $minorStudentTermId; | |
| $subject->consolidated->academicPaperSubjectId = $subject->id; | |
| $subject->consolidated->id = $subject->id; | |
| $subject->consolidated->studentId = $studentId; | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $minorSemHistory->examAttendedGroupId; | |
| $searchRequest->academicTermId = $minorStudentTermId; | |
| $searchRequest->academicPaperSubjectId = $subject->id; | |
| $subjectGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $gradeDetails[$subject->id] = current($subjectGradeSchemeArray)->grades; | |
| $maxGradePercent = current($gradeDetails[$subject->id])->rangeTo; | |
| $subject->lastMonthYear = strtotime("01 $subject->monthYearOfPassing"); | |
| $subject->consolidated->totalMarks = $subject->totalMarkObtained ? $subject->totalMarkObtained : 0; | |
| $subject->consolidated->internalMark = $subject->internalMark; | |
| $subject->consolidated->isInternalNull = $subject->isInternalNull; | |
| $subject->consolidated->internalAttendanceStatus = $subject->isInternalAbsent; | |
| $subject->consolidated->percentage = $subject->percentage ? $subject->percentage : 0; | |
| $subject->consolidated->credit = $subject->credit ? $subject->credit : 0; | |
| $subject->consolidated->grade = $subject->grade ? $subject->grade : ""; | |
| $subject->consolidated->class = $subject->className ? $subject->className : ""; | |
| $subject->consolidated->gradePoint = $subject->gradePoint ? $subject->gradePoint : 0; | |
| $subject->consolidated->creditGradePoint = $subject->creditGradePoint ? $subject->creditGradePoint : 0; | |
| $subject->consolidated->noOfChancesTaken = $subject->supplyAttemptCount + 1; | |
| $internalGrade = $this->getGradeByPercentage(($subject->internalMark/$subject->internalMaxMark)*$maxGradePercent, $gradeDetails[$subjectId]); | |
| $internalGrade->gradePoint = $internalGrade->gradePoint; | |
| $subject->internalGrade = $internalGrade->letterGrade; | |
| $subject->internalGradePoint = $internalGrade->gradePoint; | |
| $subjectmarkHistory = []; | |
| foreach ($subject->markHistory as $markHistoryType => $markHistory) { | |
| if($markHistoryType == ExamType::REGULAR ) { | |
| $regularExamSubjectData = $subject; | |
| $subjectmarkHistoryObj = new \stdClass(); | |
| $subjectmarkHistoryObj->examMarkType = $markHistoryType; | |
| $subjectmarkHistoryObj->examRegistrationId = $markHistory->examRegistrationId; | |
| $subjectmarkHistoryObj->assessmentId = $markHistory->assessmentId; | |
| $subjectmarkHistoryObj->oeExamId = $markHistory->oeExamId; | |
| $subjectmarkHistoryObj->externalMark = $regularExamSubjectData->externalMark; | |
| $subjectmarkHistoryObj->externalMarkObtainedInExam = $markHistory->markObtainedInExam; | |
| $subjectmarkHistoryObj->externalMaxMark = $subject->externalMaxMark; | |
| $externalGradePointForGradeCalc = (($subjectmarkHistoryObj->externalMark+$subject->graceMark)/$subjectmarkHistoryObj->externalMaxMark)*$maxGradePercent; | |
| $externalGrade = $this->getGradeByPercentage($externalGradePointForGradeCalc, $gradeDetails[$subjectId]); | |
| $externalGrade->gradePoint = $externalGrade->gradePoint; | |
| $subjectmarkHistoryObj->externalGrade = $externalGrade->letterGrade; | |
| $subjectmarkHistoryObj->externalGradePoint = $externalGrade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->markObtained = $regularExamSubjectData->totalMarkObtained; | |
| $subjectmarkHistoryObj->totalMark = $subject->internalMaxMark + $subject->externalMaxMark; | |
| $subjectmarkHistoryObj->percentage = ($subjectmarkHistoryObj->markObtained/$subjectmarkHistoryObj->totalMark) * 100; | |
| $subjectmarkHistoryObj->internalMark = $regularExamSubjectData->internalMark; | |
| $subjectmarkHistoryObj->isInternalNull = $subject->isInternalNull; | |
| $subjectmarkHistoryObj->internalAttendanceStatus = $subject->isInternalAbsent; | |
| $subjectmarkHistoryObj->internalGrade = $subject->internalGrade; | |
| $subjectmarkHistoryObj->internalGradePoint = $subject->internalGradePoint; | |
| $percentageObtainedInternal = round(($maxGradePercent * $regularExamSubjectData->internalMark / $subject->internalMaxMark), 2); | |
| $percentageObtainedExternal = round(($maxGradePercent * $subjectmarkHistoryObj->externalMark / $subjectmarkHistoryObj->externalMaxMark), 2); | |
| if($student->batchStartYear > 2018 && $subject->isInternal && $subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (4 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| }else if ($subject->isInternal && $subject->isExternal) { | |
| $subjectmarkHistoryObj->wgpa = ($percentageObtainedInternal + (3 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectmarkHistoryObj->wgpa = round($subjectmarkHistoryObj->wgpa, 2) ?? 0; | |
| } | |
| else if ($subject->isInternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedInternal, 2) ?? 0; | |
| } | |
| else if ($subject->isExternal){ | |
| $subjectmarkHistoryObj->wgpa = round($percentageObtainedExternal, 2) ?? 0; | |
| } | |
| $grade = $this->getGradeByPercentage($subjectmarkHistoryObj->percentage * $maxGradePercent/100, $gradeDetails[$subjectId]); | |
| $grade->gradePoint = $regularExamSubjectData->gradePoint; | |
| $subjectmarkHistoryObj->creditxMark = $subject->credit * $subjectmarkHistoryObj->markObtained; | |
| $subjectmarkHistoryObj->grade = $regularExamSubjectData->grade; | |
| $subjectmarkHistoryObj->class = $regularExamSubjectData->className; | |
| $subjectmarkHistoryObj->percentageObtainedExternal = $percentageObtainedExternal; | |
| $subjectmarkHistoryObj->percentageObtainedInternal = $percentageObtainedInternal; | |
| $subjectmarkHistoryObj->gradePoint = $grade->gradePoint ?? 0; | |
| $subjectmarkHistoryObj->creditGradePoint = $subject->credit * $subjectmarkHistoryObj->gradePoint ; | |
| $subjectmarkHistoryObj->examMonth = $markHistory->month; | |
| $subjectmarkHistoryObj->examYear = $markHistory->year; | |
| $subjectmarkHistoryObj->attendanceStatus = $markHistory->externalAttendanceStatus; | |
| $subjectmarkHistoryObj->resultStatus = $regularExamSubjectData->isFailed ? "FAILED" : "PASSED"; | |
| $subjectmarkHistoryObj->markNeededToPass = $regularExamSubjectData->isFailed ? $regularExamSubjectData->markNeededToPass : 0; | |
| $subjectmarkHistoryObj->markNeededToPassExternal = $regularExamSubjectData->isExternalFailed ? $regularExamSubjectData->markNeededToPassExternal : 0; | |
| $subjectmarkHistoryObj->markNeededToPassOverAll = $regularExamSubjectData->isFailed ? $regularExamSubjectData->markNeededToPassOverAll : 0; | |
| $subjectmarkHistoryObj->isInternal = $subject->isInternal; | |
| $subjectmarkHistoryObj->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
| $subjectmarkHistoryObj->isProjectGroupSubject = $subject->isProjectGroupSubject; | |
| $subjectmarkHistoryObj->finalSemProjectCredit = $subject->finalSemProjectCredit; | |
| $subjectmarkHistoryObj->finalSemInternalMarkProject = $subject->finalSemInternalMarkProject; | |
| $subjectmarkHistoryObj->percentageObtainedForProject = $subject->percentageObtainedForProject; | |
| $subjectmarkHistoryObj->projectSubjectIsFailed = $subject->projectSubjectIsFailed; | |
| $subjectmarkHistoryObj->creditGradePointProject = $subject->creditGradePointProject; | |
| $subjectmarkHistoryObj->isFinalSemSubject = $subject->isFinalSemSubject; | |
| $subjectmarkHistoryObj->isExternal = $subject->isExternal; | |
| $subjectmarkHistoryObj->examName = trim($markHistory->name); | |
| //for exam written mark details | |
| $regularHistory = new \stdClass(); | |
| $regularHistory->mark = $subjectmarkHistoryObj->externalMarkObtainedInExam; | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $minorStudentTermId, $regularHistory); | |
| $typeVariable = "externalMarkObtainedInExam"; | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| //for getting gracemark, revaluation, moderation - gradepoints and marks | |
| foreach ($markHistory->markType as $typeKey => $subjectMarkType){ | |
| $typeVariable = ""; | |
| if($typeKey == "REVALUATION"){ | |
| $typeVariable = "revaluation"; | |
| } | |
| else if($typeKey == "GRACEMARK"){ | |
| $typeVariable = "graceMark"; | |
| } | |
| else if($typeKey == "MODERATION"){ | |
| $typeVariable = "moderation"; | |
| } | |
| if( $typeVariable ){ | |
| $markVar = $typeVariable."Mark"; | |
| if($typeKey == "GRACEMARK"){ | |
| $markVar = "graceMark"; | |
| } | |
| $subjectmarkHistoryObj->$markVar = $subjectMarkType->mark; | |
| if($typeKey == "GRACEMARK" || $typeKey == "MODERATION"){ | |
| $subjectMarkType->mark += $subjectmarkHistoryObj->externalMarkObtainedInExam; | |
| } | |
| $markHistoryStatus = $this->getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $minorStudentTermId, $subjectMarkType); | |
| if ( $markHistoryStatus ){ | |
| $gradeVar = $typeVariable."Grade"; | |
| $subjectmarkHistoryObj->$gradeVar = $markHistoryStatus->letterGrade; | |
| $gradePointVar = $typeVariable."GradePoint"; | |
| $subjectmarkHistoryObj->$gradePointVar = $markHistoryStatus->gradePoint; | |
| $creditGradePointVar = $typeVariable."CreditGradePoint"; | |
| $subjectmarkHistoryObj->$creditGradePointVar = $markHistoryStatus->creditGradePoint; | |
| $isFailedVar = $typeVariable."IsFailed"; | |
| $subjectmarkHistoryObj->$isFailedVar = $markHistoryStatus->isFailed; | |
| } | |
| } | |
| } | |
| $subjectmarkHistory[] = $subjectmarkHistoryObj; | |
| } | |
| } | |
| $subject->consolidated->markHistory = $subjectmarkHistory; | |
| $subject->consolidated->status = $subject->isFailed ? "FAILED" : "PASSED"; | |
| $subjectMarkDetails = new \stdClass(); | |
| $subjectMarkDetails->code = $subject->subjectName; | |
| $subjectMarkDetails->syllabusCode = $subject->syllabusCode; | |
| $subjectMarkDetails->priority = $subject->subjectPriority; | |
| $subjectMarkDetails->categoryId = $subject->subjectCatId; | |
| $subjectMarkDetails->categoryName = $subject->subjectCatName; | |
| $subjectMarkDetails->categoryCode = $subject->subjectCatCode; | |
| $subjectMarkDetails->isInternal = $subject->isInternal; | |
| $subjectMarkDetails->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
| $subjectMarkDetails->internalMark = $subject->internalMark; | |
| $subjectMarkDetails->isInternalNull = $subject->isInternalNull; | |
| $subjectMarkDetails->internalAttendanceStatus = $subject->isInternalAbsent; | |
| $subjectMarkDetails->internalMaxMark = $subject->internalMaxMark; | |
| $subjectMarkDetails->graceMark = $subject->graceMark; | |
| $subjectMarkDetails->internalGrade = $subject->letterGrade; | |
| $subjectMarkDetails->internalGradePoint = $subject->gradePoint; | |
| $subjectMarkDetails->isInternalFailed = $subject->isInternalFailed; | |
| $subjectMarkDetails->internalAttendance = $subject->isInternalAbsent; | |
| $subjectMarkDetails->isExternal = $subject->isExternal; | |
| $subjectMarkDetails->externalMark = $subject->externalMark; | |
| $subjectMarkDetails->externalMaxMark = $subject->externalMaxMark; | |
| $externalGrade = $this->getGradeByPercentage(($subjectMarkDetails->externalMark/$subjectMarkDetails->externalMaxMark)*$maxGradePercent, $gradeDetails[$subjectId]); | |
| $externalGrade->gradePoint = $externalGrade->gradePoint; | |
| $subjectMarkDetails->externalGrade = $externalGrade->letterGrade; | |
| $subjectMarkDetails->externalGradePoint = $externalGrade->gradePoint; | |
| $subjectMarkDetails->isExternalFailed = $subject->isExternalFailed; | |
| $subjectMarkDetails->maxGradePercent = $subject->maxGradePercent; | |
| $subjectMarkDetails->maxGradePoint = $subject->maxGradePoint; | |
| $subjectMarkDetails->examMonth = $subject->examMonth; | |
| $subjectMarkDetails->examYear = $subject->examYear; | |
| $subjectMarkDetails->monthYearOfPassing = $subject->monthYearOfPassing; | |
| $subjectMarkDetails->isTheory = $subject->isTheory; | |
| $subjectMarkDetails->supplyAttemptCount = $subject->supplyAttemptCount; | |
| $subjectMarkDetails->credit = $subject->credit; | |
| $subjectMarkDetails->creditGradePoint = $subject->creditGradePoint; | |
| $subjectMarkDetails->markNeededToPass = abs($subject->markNeededToPass); | |
| $subjectMarkDetails->gradePoint = $subject->gradePoint; | |
| $percentageObtainedInternal = round(($maxGradePercent * $subject->internalMark / $subject->internalMaxMark), 2); | |
| $percentageObtainedExternal = round(($maxGradePercent * ($subjectMarkDetails->externalMark + $subject->graceMark) / $subjectMarkDetails->externalMaxMark), 2); | |
| if($student->batchStartYear > 2018 && $subject->isInternal && $subject->isExternal){ | |
| $subjectMarkDetails->wgpa = ($percentageObtainedInternal + (4 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectMarkDetails->wgpa = round($subjectMarkDetails->wgpa, 2) ?? 0; | |
| }else if ($subject->isInternal && $subject->isExternal) { | |
| $subjectMarkDetails->wgpa = ($percentageObtainedInternal + (3 * $percentageObtainedExternal)) / $subject->maxGradePoint; | |
| $subjectMarkDetails->wgpa = round($subjectMarkDetails->wgpa, 2) ?? 0; | |
| } | |
| else if ($subject->isInternal){ | |
| $subjectMarkDetails->wgpa = round($percentageObtainedInternal, 2) ?? 0; | |
| } | |
| else if ($subject->isExternal){ | |
| $subjectMarkDetails->wgpa = round($percentageObtainedExternal, 2) ?? 0; | |
| } | |
| $subjectMarkDetails->grade = $subject->grade; | |
| $subjectMarkDetails->class = $subject->className ? $subject->className : ""; | |
| $subjectMarkDetails->creditxMark = $subject->creditxMark; | |
| $subjectMarkDetails->markObtained = $subject->totalMark; | |
| $subjectMarkDetails->totalMarks = $subject->totalMaxMark; | |
| $subjectMarkDetails->isFailed = $subject->isFailed; | |
| $subjectMarkDetails->percentageObtainedExternal = $percentageObtainedExternal; | |
| $subjectMarkDetails->percentageObtainedInternal = $percentageObtainedInternal; | |
| $subjectMarkDetails->internalPassPercentage = $subject->internalPassCriteria; | |
| $subjectMarkDetails->externalPassPercentage = $subject->externalPassCriteria; | |
| $subjectMarkDetails->aggregatePassPercentage = $subject->overallPassCriteria; | |
| $subjectMarkDetails->attendance = $subject->externalAttendanceStatus; | |
| $subjectMarkDetails->latestExamYear = date("Y",strtotime("01 $subject->monthYearOfPassing")); | |
| $subjectMarkDetails->latestExamMonth = date("m",strtotime("01 $subject->monthYearOfPassing")); | |
| $subjectMarkDetails->latestExamType = $subject->examRegTypeOfPassing; | |
| $subjectMarkDetails->attendanceStatus = $subject->isAbsent ; | |
| $subjectMarkDetails->internalMark = $subject->internalMark; | |
| $subjectMarkDetails->internalMaxMark = $subject->internalMaxMark; | |
| $subjectMarkDetails->internalResultStatus = $subject->isInternalFailed ? "FAILED" : "PASSED"; | |
| $subjectMarkDetails->externalMark = $subject->externalMark; | |
| $subjectMarkDetails->externalMaxMark = $subject->externalMaxMark; | |
| $subjectMarkDetails->externalResultStatus = $subject->isExternalFailed ? "FAILED" : "PASSED"; | |
| $subjectMarkDetails->maxGradePoint = $subject->maxGradePoint; | |
| $subjectMarkDetails->maxGradePercentage = $subject->maxGradePercent; | |
| $subject->consolidated->markDetails = $subjectMarkDetails; | |
| $student->semMarks[$minorStudentTermId]->subject[$subject->id] = $subject; | |
| } | |
| } | |
| } | |
| unset($minorHonorStudentDetails); | |
| /***********************end minor honor case*********************************/ | |
| // $student->creditGradePoint = array_sum(array_column($student->semMarks,"creditGradePoint")); | |
| // $student->credit = array_sum(array_column($student->semMarks,"credit")); | |
| // $student->cgpa = $student->creditGradePoint / $student->credit; | |
| $student->rawCgpa = $student->cgpa; | |
| $student->cgpa = $student->batchStartYear > 2018 ? round($student->cgpa, 3) : round($student->cgpa, 2); | |
| $student->consolidated->noOfArrears = $student->totalArrears ? $student->totalArrears : 0; | |
| $student->consolidated->supplyAttemptCount = $student->supplyAttemptCount ? $student->supplyAttemptCount : 0; | |
| $student->consolidated->totalMark = $student->totalMarkObtained ? $student->totalMarkObtained : 0; | |
| $student->consolidated->percentage = ($student->totalMarkObtained / $student->totalMark) * 100; | |
| $student->consolidated->grade = $student->grade ? $student->grade : ""; | |
| $student->consolidated->cgpa = $student->cgpa ? $student->cgpa : 0; | |
| $student->consolidated->rawCgpa = $student->rawCgpa ?? 0; | |
| // without gracemark | |
| $student->consolidated->cgpaWithoutGracemark = $studentDetailsWithoutGracemark->cgpa; | |
| $student->consolidated->rawCgpaWithoutGracemark = $studentDetailsWithoutGracemark->rawCgpa; | |
| $student->consolidated->class = $student->class ? $student->class : ""; | |
| $student->consolidated->status = $student->isFailed ? "FAILED" : "PASSED"; | |
| $studentMarkDetails = new \stdClass(); | |
| $studentMarkDetails->noOfChancesTaken = max(array_column(array_column(array_column($student->semMarks,"consolidated"),"markDetails"),"noOfChancesTaken")); | |
| $studentMarkDetails->credit = $student->credit; | |
| $studentMarkDetails->creditGradePoint = $student->creditGradePoint; | |
| $studentMarkDetails->latestExamYear = $student->lastExamYear; | |
| $studentMarkDetails->latestExamMonth = $student->lastExamMonth; | |
| $studentMarkDetails->latestExamType = $student->lastExamReg; | |
| $studentMarkDetails->totalMaxMark = $student->totalMark; | |
| $studentMarkDetails->arrearCount = $student->totalArrears; | |
| $studentMarkDetails->supplyAttemptCount = $student->supplyAttemptCount; | |
| $studentMarkDetails->credit = $student->credit; | |
| $studentMarkDetails->creditGradePoint = $student->creditGradePoint; | |
| $studentMarkDetails->markObtained = $student->totalMarkObtained; | |
| $studentMarkDetails->totalMarks = $student->totalMark; | |
| $studentMarkDetails->isFailed = $student->isFailed; | |
| $studentMarkDetails->cgpa = $student->cgpa; | |
| $studentMarkDetails->rawCgpa = $student->rawCgpa; | |
| $studentMarkDetails->cgpaWithoutGracemark = $studentDetailsWithoutGracemark->cgpa; | |
| $studentMarkDetails->rawCgpaWithoutGracemark = $studentDetailsWithoutGracemark->rawCgpa; | |
| // $studentMarkDetails->wgp = $student->wgp; | |
| $studentMarkDetails->wgpa = $student->wgpa ?? 0; | |
| $studentMarkDetails->gradePoint = $student->gradePoint; | |
| $studentMarkDetails->creditxMark = $student->creditxMark; | |
| $studentMarkDetails->grade = $student->grade; | |
| $studentMarkDetails->class = $student->class; | |
| $studentMarkDetails->creditxMark = $student->creditxMark; | |
| $studentMarkDetails->passingYear = $student->passingYear; | |
| $studentMarkDetails->passingMonth = $student->passingMonth; | |
| $studentMarkDetails->hasCompletedAcademicYear = $student->hasCompletedAcademicYear; | |
| if( !$student->isFailed && !$student->hasPassYearUpdated && $student->hasCompletedAcademicYear ){ | |
| if ( $student->finalRegularExamYear < $student->lastSupplyYear ) { | |
| $studentMarkDetails->passingYear = $student->lastSupplyYear; | |
| $studentMarkDetails->passingMonth = $student->lastSupplyMonth; | |
| } else if ($student->finalRegularExamYear == $student->lastSupplyYear && $student->finalRegularExamMonth < $student->lastSupplyMonth) { | |
| $studentMarkDetails->passingYear = $student->lastSupplyYear; | |
| $studentMarkDetails->passingMonth = $student->lastSupplyMonth; | |
| } | |
| else{ | |
| $studentMarkDetails->passingYear = $student->finalRegularExamYear; | |
| $studentMarkDetails->passingMonth = $student->finalRegularExamMonth; | |
| } | |
| } | |
| $student->consolidated->markDetails = $studentMarkDetails; | |
| } | |
| return $studentDetails; | |
| } | |
| protected function getStudentSubjectGradeDetailsForMarkHistory($request, $subject, $semId, $markHistory) | |
| { | |
| $schemeType = "PERCENTAGE"; | |
| $passCriteriaArrayOfSubject = GradeSchemeService::getInstance()->getSubjectPassCriteriaByAcademicPaperSubject($subject->id, $schemeType); | |
| $searchRequest = new \stdClass(); | |
| // $searchRequest->groupId = $request->groupId; | |
| $searchRequest->academicTermId = $semId; | |
| $searchRequest->academicPaperSubjectId = $subject->academicPaperSubjectId; | |
| $subjectGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $gradeDetails = current($subjectGradeSchemeArray)->grades; | |
| $maxGradePercent = $gradeDetails[0]->rangeTo; | |
| $checkPassPercentCriteria = new \stdClass(); | |
| $checkPassPercentCriteria->isInternal = $subject->isInternal; | |
| $checkPassPercentCriteria->isTheory = $subject->isTheory; | |
| $checkPassPercentCriteria->internalMaxMark = $subject->internalMaxMark; | |
| $checkPassPercentCriteria->isExternal = $subject->isExternal; | |
| $checkPassPercentCriteria->externalMaxMark = $subject->externalMaxMark; | |
| $checkPassPercentCriteria->internalMark = round($subject->internalMark, 2); | |
| // $checkPassPercentCriteria->considerOverallPassCriteriaOnly = $considerOverallPassCriteriaOnly; | |
| $checkPassPercentCriteria->passPercentConfig = $passCriteriaArrayOfSubject; | |
| $checkPassPercentCriteria->examAdditionalMark1 = $subject->examAdditionalMark1; | |
| $isFailedForTheSubject = $this->checkIsFailedByPassPercentCriteria ( $checkPassPercentCriteria ); | |
| if ( $isFailedForTheSubject ) { | |
| $percentageObtained = 0; | |
| // $semesterGradePercentObtained = 0; | |
| } | |
| else { | |
| $percentageObtained = $maxGradePercent * (round($subject->internalMark, 2) + $markHistory->mark) / ($subject->externalMaxMark + $subject->internalMaxMark); | |
| $percentageObtained = round($percentageObtained, 2); | |
| // $semesterGradePercentObtained = $maxSemesterGradePercent * $studentExamTotal / $examTotal; | |
| // $semesterGradePercentObtained = round($semesterGradePercentObtained, 2); | |
| } | |
| $grade = $this->getGradeByPercentage($percentageObtained, $gradeDetails); | |
| if (!empty ($grade)) { | |
| $creditGradePoint = ($subject->credit * $grade->gradePoint); | |
| if ($grade->failStatus == 1) { | |
| $isFailedForTheSubject = 1; | |
| } | |
| } | |
| $grade->isFailed = $isFailedForTheSubject; | |
| $grade->creditGradePoint = $creditGradePoint; | |
| return $grade; | |
| } | |
| protected function getGradeByPercentage($percentage, $gradeDetails) | |
| { | |
| foreach ($gradeDetails as $grade) { | |
| if ($grade->rangeFrom <= $percentage && $grade->rangeTo >= $percentage) { | |
| return $grade; | |
| } | |
| } | |
| return null; | |
| } | |
| protected function getStudentImprovementExamDetailsForThisExam($academicPaperSubjectId, $studentId, $improveExamDetails) | |
| { | |
| $examMark = null; | |
| foreach ($improveExamDetails as $improveExam) { | |
| if ($improveExam->subject->academicPaperSubjectId == $academicPaperSubjectId) { | |
| foreach ($improveExam->studentMarks as $studentMarks) { | |
| if ($studentMarks->student->studentId == $studentId) { | |
| $examMark = $studentMarks; | |
| $examMark->assessmentId = $improveExam->assessmentId; | |
| $examMark->oeExamId = $improveExam->oeExamId; | |
| $examMark->examRegistrations = $improveExam->examRegistrations; | |
| } | |
| } | |
| } | |
| } | |
| return $examMark; | |
| } | |
| protected function getStudentExamDetails($assessmentId, $studentId, $examDetails) | |
| { | |
| $examMark = null; | |
| $exam = reset(array_filter($examDetails,function($exam)use($assessmentId){ | |
| return $exam->assessmentId == $assessmentId; | |
| })); | |
| if($exam){ | |
| $examObject = reset(array_filter($exam->studentMarks,function($studentMarks)use($studentId){ | |
| return $studentMarks->student->studentId == $studentId; | |
| })); | |
| if($examObject){ | |
| $examMark = $examObject; | |
| $examMark->assessmentId = $exam->assessmentId; | |
| $examMark->examRegistrations = $exam->examRegistrations; | |
| } | |
| } | |
| return $examMark; | |
| } | |
| public function getSupplyMarkHistory ($academicPaperSubjectId, $studentId, $supplyExamDetails) { | |
| $supplyExamMarks = []; | |
| $exams = array_filter($supplyExamDetails,function($exam)use($academicPaperSubjectId){ | |
| return $exam->subject->academicPaperSubjectId == $academicPaperSubjectId; | |
| }); | |
| foreach ($exams as $supplyExam) { | |
| foreach ($supplyExam->studentMarks as $studentMarks) { | |
| if ($studentMarks->student->studentId == $studentId) { | |
| $supplyExamMark = new \stdClass(); | |
| $supplyExamMark->id = $supplyExam->examRegistrations->examRegistrationId; | |
| $supplyExamMark->assessmentId = $supplyExam->assessmentId; | |
| $supplyExamMark->oeExamId = $supplyExam->oeExamId; | |
| $supplyExamMark->mark = $studentMarks->externalMark; | |
| $supplyExamMark->externalAttendanceStatus = $studentMarks->externalAttendanceStatus; | |
| $supplyExamMark->examMonth = $supplyExam->examRegistrations->month; | |
| $supplyExamMark->examYear = $supplyExam->examRegistrations->year; | |
| $supplyExamMark->supplyName = $supplyExam->examRegistrations->name; | |
| $supplyExamMarks[] = $supplyExamMark; | |
| break; | |
| } | |
| } | |
| } | |
| return $supplyExamMarks; | |
| } | |
| public function checkIsFailedByPassPercentCriteria ( $checkPassPercentCriteria ) { | |
| $studentExamTotal = 0; | |
| $examTotal = 0; | |
| $isFailed = 0; | |
| $internalPassCriteria = $externalPassCriteria = $overallPassCriteria = null; | |
| if ($checkPassPercentCriteria->passPercentConfig->internalPassCriteria) { | |
| $internalPassCriteria = (float) $checkPassPercentCriteria->passPercentConfig->internalPassCriteria; | |
| } | |
| if ($checkPassPercentCriteria->passPercentConfig->externalPassCriteria) { | |
| $externalPassCriteria = (float) $checkPassPercentCriteria->passPercentConfig->externalPassCriteria; | |
| } | |
| if ($checkPassPercentCriteria->passPercentConfig->overallPassCriteria) { | |
| $overallPassCriteria = (float) $checkPassPercentCriteria->passPercentConfig->overallPassCriteria; | |
| } | |
| if ($checkPassPercentCriteria->isInternal) { | |
| $studentExamTotal = $checkPassPercentCriteria->internalMark; | |
| $examTotal = $checkPassPercentCriteria->internalMaxMark; | |
| if (!empty ($internalPassCriteria)) { | |
| $internalPercent = $checkPassPercentCriteria->internalMaxMark ? (100 * $checkPassPercentCriteria->internalMark / $checkPassPercentCriteria->internalMaxMark) : 0; | |
| if ( $checkPassPercentCriteria->considerOverallPassCriteriaOnly == 0 ) { | |
| $isFailed = $internalPassCriteria <= $internalPercent ? $isFailed : 1; | |
| } | |
| } | |
| } | |
| if ($checkPassPercentCriteria->isExternal) { | |
| $studentExamTotal += $checkPassPercentCriteria->externalMark; | |
| $examTotal += $checkPassPercentCriteria->externalMaxMark; | |
| if (!empty ($externalPassCriteria)) { | |
| $externalPercent = $checkPassPercentCriteria->externalMaxMark ? (100 * | |
| $checkPassPercentCriteria->externalMark / $checkPassPercentCriteria->externalMaxMark) : 0; | |
| if ( $checkPassPercentCriteria->considerOverallPassCriteriaOnly == 0 && ($checkPassPercentCriteria->isTheory)) { | |
| $isFailed = $externalPassCriteria <= $externalPercent ? $isFailed : 1; | |
| } | |
| } | |
| } | |
| $studentExamTotal = ceil($studentExamTotal); | |
| if (!empty ($overallPassCriteria)) { | |
| if (empty($checkPassPercentCriteria->studentExamTotal)) | |
| $overallPercent = $examTotal ? 100 * $studentExamTotal / $examTotal : 0; | |
| else | |
| $overallPercent = $checkPassPercentCriteria->totalMaxMark ? 100 * $checkPassPercentCriteria->studentExamTotal / $checkPassPercentCriteria->totalMaxMark : 0; | |
| $isFailed = $overallPassCriteria <= $overallPercent ? $isFailed : 1; | |
| } | |
| return $isFailed; | |
| } | |
| public function getSemesterGradeDetials($searchReq, $sgpa) | |
| { | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $searchReq->groupId; | |
| $searchRequest->academicTermId = $searchReq->academicTermId; | |
| $searchRequest->requestType = "SEMESTER"; | |
| $semesterGradeDetails = reset(GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest))->grades; | |
| $semMarkGrade = $this->getGradeByPercentage($sgpa, $semesterGradeDetails); | |
| return $semMarkGrade; | |
| } | |
| /** | |
| * Get Students supplementary mark report | |
| */ | |
| public function getStudentsSupplyMarkReport ( $request, $supplyExamDetails = null ) { | |
| $students = []; | |
| $subjects = []; | |
| $passCriteriaArray = []; | |
| $includeImprovement = false; | |
| $includeImprovement = $request->includeImprovement ?? false; | |
| if( empty ( $supplyExamDetails ) ){ | |
| $supplyHistoryRequestObj = new ConsolidatedOverAllMarkReportRequest(); | |
| $supplyHistoryRequestObj->studentId = $request->studentId; | |
| $supplyHistoryRequestObj->examRegistrationId = $request->examRegistrationId; | |
| $supplyHistoryRequestObj->academicTermId = $request->academicTermId; | |
| $supplyHistoryRequestObj->examRegistrationType = ExamRegistrationTypeConstants::SUPPLEMENTARY; | |
| $supplyExamDetails = StudentsOverAllMarkReportService::getInstance()->getStudentExamMarkDetails($supplyHistoryRequestObj); | |
| } | |
| if ( !empty ( $supplyExamDetails ) ) { | |
| $examMonth = current($supplyExamDetails)->examRegistrations->month; | |
| $examYear = current($supplyExamDetails)->examRegistrations->year; | |
| $request->examYear = $examYear; | |
| $request->examMonth = $examMonth; | |
| $studentObj = null; | |
| /** Getting the mark details of that batch **/ | |
| if ( empty ( $studentObj ) ) { | |
| $request->examRegistrationType = ExamType::REGULAR; | |
| $request->examRegistrationId = ""; | |
| $examDetails = json_decode(json_encode($request->studentRegularExamDetails)); | |
| $request->supplementaryYearUpperLimit = $examYear; | |
| $request->supplementaryMonthUpperLimit = $examMonth; | |
| $studentObj = $this->getStudentsOverallMarkReport($request, $examDetails); | |
| $request->supplementaryYearUpperLimit = ''; | |
| $request->supplementaryMonthUpperLimit = ''; | |
| } | |
| if ( $request->considerModerationMark ) { | |
| $moderationMarkDetails = $request->moderationMarkDetails; | |
| } | |
| if ( $request->considerGraceMark ) { | |
| $graceMarkDetails = $request->graceMarkDetails; | |
| } | |
| $courseType = new \stdClass(); | |
| $courseType->courseTypeMethod = reset($supplyExamDetails)->batch->courseType; | |
| $courseType->courseTypeName = reset($supplyExamDetails)->batch->courseTypeName; | |
| $courseType->isPG = 0; | |
| if ($courseType->courseTypeMethod == 'PG') { | |
| $courseType->isPG = 1; | |
| } | |
| $courseTypeId = reset($examDetails)->batch->courseTypeId; | |
| $batchStartYear = reset($supplyExamDetails)->batch->startYear; | |
| // Enable internal normalization based on rule settings | |
| if ($request->ruleSettings->internalNormalizationSettings) { | |
| foreach ($request->ruleSettings->internalNormalizationSettings as $internalNormalizationSetting) { | |
| if (in_array($courseTypeId, explode(',', $internalNormalizationSetting->courseType)) && in_array($batchStartYear, explode(',', $internalNormalizationSetting->batchStartYear))) { | |
| $request->enableInternalNormalization = true; | |
| } | |
| } | |
| } | |
| foreach ($supplyExamDetails as $examDetail) { | |
| $totalMaxMark = 0; | |
| $academicPaperSubjectId = $examDetail->subject->academicPaperSubjectId; | |
| $batchId = $examDetail->batch->groupId; | |
| $academicTermId = $examDetail->semester->academicTermId; | |
| $courseTypeId = $examDetail->batch->courseTypeId; | |
| $regularSubjectDetails = $studentObj[$request->studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId]; | |
| $schemeType = "PERCENTAGE"; | |
| $passCriteriaArray[$academicPaperSubjectId] = GradeSchemeService::getInstance()->getSubjectPassCriteriaByAcademicPaperSubject($academicPaperSubjectId, $schemeType); | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $batchId; | |
| $searchRequest->academicTermId = $academicTermId; | |
| $searchRequest->academicPaperSubjectId = $examDetail->subject->academicPaperSubjectId; | |
| $subjectGradeSchemeArray = GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest); | |
| $gradeDetails = current($subjectGradeSchemeArray)->grades; | |
| $maxGradePercent = $gradeDetails[0]->rangeTo; | |
| $considerOverallPassCriteriaOnly = 0; | |
| if ( $examDetail->subject->subjectType == ExamSubjectTypeConstants::OPEN_ELECTIVE || | |
| $examDetail->subject->subjectType == ExamSubjectTypeConstants::FOUNDATION_COURSE || | |
| $examDetail->subject->subjectType == ExamSubjectTypeConstants::TERM_PAPER ) { | |
| $considerOverallPassCriteriaOnly = 1; | |
| } | |
| /** Object checking whether a student is passed for a subject by the pass percent criteria **/ | |
| $checkPassPercentCriteria = new \stdClass(); | |
| $checkPassPercentCriteria->isInternal = $examDetail->subject->isInternal; | |
| $checkPassPercentCriteria->isTheory = $examDetail->subject->isTheory; | |
| $checkPassPercentCriteria->internalMaxMark = $examDetail->internalMaxMark; | |
| $checkPassPercentCriteria->isExternal = $examDetail->subject->isExternal; | |
| $checkPassPercentCriteria->externalMaxMark = $examDetail->externalMaxMark; | |
| $checkPassPercentCriteria->considerOverallPassCriteriaOnly = $considerOverallPassCriteriaOnly; | |
| /** For getting the supplementary subject details **/ | |
| $subjects[$academicPaperSubjectId]->id = $academicPaperSubjectId; | |
| $subjects[$academicPaperSubjectId]->subjectOrder = $examDetail->subject->subjectOrder; | |
| $subjects[$academicPaperSubjectId]->subjectName = $examDetail->subject->subjectName; | |
| $subjects[$academicPaperSubjectId]->subjectDesc = $examDetail->subject->subjectDesc; | |
| $subjects[$academicPaperSubjectId]->syllabusCode = $examDetail->subject->syllabusCode; | |
| $subjects[$academicPaperSubjectId]->subjectCatId = $examDetail->subject->subjectCatId; | |
| $subjects[$academicPaperSubjectId]->internalMaxMark = $examDetail->internalMaxMark; | |
| $subjects[$academicPaperSubjectId]->externalMaxMark = $examDetail->externalMaxMark; | |
| $subjects[$academicPaperSubjectId]->supplyAssessmentId= $examDetail->assessmentId; | |
| if ($examDetail->subject->isInternal == 1) { | |
| $totalMaxMark += $examDetail->internalMaxMark; | |
| } | |
| if ($examDetail->subject->isExternal == 1) { | |
| $totalMaxMark += $examDetail->externalMaxMark; | |
| } | |
| $subjects[$academicPaperSubjectId]->totalMaxMark = $totalMaxMark; | |
| $subjects[$academicPaperSubjectId]->excludeSubjectFromTotal = $examDetail->subject->excludeSubjectFromTotal; | |
| /** Subject details ends **/ | |
| foreach ($examDetail->studentMarks as $studentMark) { | |
| $isFailed = null; | |
| $examTotal = 0; | |
| $studentExamTotal = 0; | |
| $studentId = $studentMark->student->studentId; | |
| $studentMark->externalMark = round ( $studentMark->externalMark, 2); | |
| if( $studentMark->improvedInternalMark || $studentMark->improvedInternalAttendanceStatus){ | |
| $studentMark->internalMark = $studentMark->improvedInternalMark; | |
| $studentMark->internalAttendanceStatus = $studentMark->improvedInternalAttendanceStatus; | |
| } | |
| if ($request->considerModerationMark && $examDetail->subject->isExternal){ | |
| //get moderation mark | |
| $studentModerationMark = $this->getStudentExamDetails($examDetail->assessmentId, $studentId, $moderationMarkDetails); | |
| if($studentModerationMark){ | |
| $studentMark->externalMark += $studentModerationMark->externalMark; | |
| } | |
| } | |
| if ( $request->considerRevaluation) { | |
| $revalRequest = new \stdClass(); | |
| $revalRequest->studentId = $studentId; | |
| $revalRequest->assessmentId = $examDetail->assessmentId; | |
| $revalRequest->orderByHighestMark = 1; | |
| $studentRevaluationDetails = StudentsOverAllMarkReportService::getInstance()->getStudentFinalizedRevaluationMark($revalRequest); | |
| if($studentRevaluationDetails){ | |
| $studentRevaluationDetail = current(current($studentRevaluationDetails)->students); | |
| if($studentRevaluationDetail->revaluationMark){ | |
| $studentRevaluationMark = $studentRevaluationDetail->revaluationMark; | |
| } | |
| $studentRevaluationMark = round($studentRevaluationMark, 2); | |
| //apply moderation to revaluation mark | |
| if ($request->considerModerationMark && $examDetail->subject->isExternal){ | |
| //get moderation mark | |
| $studentModerationMark = $this->getStudentExamDetails($examDetail->assessmentId, $studentId, $moderationMarkDetails); | |
| if($studentModerationMark){ | |
| $moderationMark = $studentModerationMark->externalMark; | |
| } | |
| $studentRequest = new \stdClass(); | |
| $studentRequest->externalPassMark = round($passCriteriaArray[$academicPaperSubjectId]->externalPassCriteria * ($examDetail->externalMaxMark / 100),2); | |
| $studentRequest->overallPassMark = round($passCriteriaArray[$academicPaperSubjectId]->overallPassCriteria * (($examDetail->externalMaxMark + $examDetail->internalMaxMark) / 100), 2); | |
| // if(!$moderationMark){ | |
| // $studentRequest->isSupply = true; | |
| // $studentRequest->examRegId = $request->supplyRegId; | |
| // $moderationMark = ExamValuationRuleService::getInstance()->getMaxModerationMarkByExamRequest($studentRequest)->maxModerationMark; | |
| // } | |
| if ($moderationMark) { | |
| if (!empty($passCriteriaArray[$academicPaperSubjectId]->externalPassCriteria)) { | |
| $studentRequest->maxModerationMarkAllowed = $studentRequest->maxModerationMarkAllowedExt = $studentRequest->externalPassMark - $studentRevaluationMark; | |
| } | |
| if (!empty($passCriteriaArray[$academicPaperSubjectId]->overallPassCriteria)) { | |
| $studentRequest->maxModerationMarkAllowed = $studentRequest->overallPassMark - ($studentRevaluationMark + $studentMark->internalMark); | |
| } | |
| $studentRequest->maxModerationMarkAllowed = ($studentRequest->maxModerationMarkAllowed > $studentRequest->maxModerationMarkAllowedExt) ? $studentRequest->maxModerationMarkAllowed : $studentRequest->maxModerationMarkAllowedExt; | |
| $studentRequest->maxModerationMarkAllowed = ($studentRequest->maxModerationMarkAllowed > 0) ? $studentRequest->maxModerationMarkAllowed : 0; | |
| $moderationMark = ($moderationMark > $studentRequest->maxModerationMarkAllowed) ? $studentRequest->maxModerationMarkAllowed : $moderationMark; | |
| } | |
| if((($studentRevaluationMark + $moderationMark) >= $studentRequest->externalPassMark) && (($studentRevaluationMark + $moderationMark + $studentMark->internalMark) >= $studentRequest->overallPassMark)){ | |
| $studentRevaluationMark = ($moderationMark) ? ((($studentRevaluationMark + $moderationMark) > $studentRequest->externalPassMark) ? ($studentRevaluationMark + $moderationMark) : ($studentRevaluationMark + $moderationMark)) : $studentRevaluationMark; | |
| } | |
| $studentMark->externalMark = $studentRevaluationMark && $studentRevaluationMark != 0? $studentRevaluationMark : $studentMark->externalMark; | |
| } | |
| } | |
| //end | |
| } | |
| if ( $request->considerGraceMark ) { | |
| $studentGraceMark = $this->getStudentExamDetails($examDetail->assessmentId, $studentId, $graceMarkDetails); | |
| if($studentGraceMark){ | |
| $studentMark->externalMark += $studentGraceMark->externalMark; | |
| } | |
| } | |
| $studentMark->internalMark = round($studentMark->internalMark, 2); | |
| $checkPassPercentCriteria->internalMark = $studentMark->internalMark; | |
| $checkPassPercentCriteria->passPercentConfig = $passCriteriaArray[$academicPaperSubjectId]; | |
| $checkPassPercentCriteria->externalMark = round ( $studentMark->externalMark, 2); | |
| $studentMark->externalMark = round ( $studentMark->externalMark, 2); | |
| $isFailed = $this->checkIsFailedByPassPercentCriteria ( $checkPassPercentCriteria ); | |
| /** code ends **/ | |
| //normalize internal marks | |
| if (!$isFailed && $examDetail->subject->isInternal && $examDetail->subject->isExternal && $courseType->isPG && $request->enableInternalNormalization) { | |
| $externalPercent = $examDetail->externalMaxMark ? round((100 * $studentMark->externalMark / $examDetail->externalMaxMark), 2) : 0; | |
| $internalPercent = $examDetail->internalMaxMark ? round((100 * $studentMark->internalMark / $examDetail->internalMaxMark), 2) : 0; | |
| if ($externalPercent && $internalPercent && ($internalPercent > $externalPercent) && (($internalPercent - $externalPercent) > 30)) { | |
| $normalizedInternalPercent = $externalPercent + 30; | |
| $normalizedInternalMark = round(($normalizedInternalPercent / 100) * $examDetail->internalMaxMark, 2); | |
| $studentExamTotal = ceil($studentMark->externalMark + $normalizedInternalMark); | |
| $percentageObtained = $maxGradePercent * $studentExamTotal / $examTotal; | |
| $percentageObtained = round($percentageObtained, 2); | |
| $studentMark->internalMark = $studentMark->internalMark = $normalizedInternalMark; | |
| unset($normalizedInternalPercent); | |
| unset($normalizedInternalMark); | |
| } | |
| } | |
| //end normalize internal marks | |
| // if (!$isFailed && $examDetail->subject->isInternal && $examDetail->subject->isExternal && ($courseType->courseTypeMethod != 'MTECH') && !(($examDetail->batch->startYear <= 2020) && ($academicTermId <= 1) && !$examDetail->subject->isTheory)) { | |
| // $externalPercent = $examDetail->externalMaxMark ? round((100 * $studentMark->externalMark / $examDetail->externalMaxMark), 2) : 0; | |
| // $internalPercent = $examDetail->internalMaxMark ? round((100 * $studentMark->internalMark / $examDetail->internalMaxMark), 2) : 0; | |
| // if ($externalPercent && $internalPercent && ($internalPercent > $externalPercent) && (($internalPercent - $externalPercent) > 30)) { | |
| // $normalizedInternalPercent = $externalPercent + 30; | |
| // $normalizedInternalMark = round(($normalizedInternalPercent / 100) * $examDetail->internalMaxMark, 2); | |
| // $normalizedInternalMark = ceil($normalizedInternalMark); | |
| // $studentMark->internalMark = $normalizedInternalMark; | |
| // unset($normalizedInternalPercent); | |
| // unset($normalizedInternalMark); | |
| // } | |
| // } | |
| $student = $students[$studentId]; | |
| $studentSemMark = $student->semMarks[$academicTermId]; | |
| $studentSubject = $studentSemMark->subject[$academicPaperSubjectId]; | |
| $studentExamTotal = 0; | |
| if (empty($studentSubject)){ | |
| $studentSubject = json_decode(json_encode($studentObj[$studentId]->semMarks[$academicTermId]->subject[$academicPaperSubjectId])); | |
| unset($studentSubject->markHistory); | |
| } | |
| if (empty($studentSemMark)){ | |
| $studentSemMark = json_decode(json_encode($studentObj[$studentId]->semMarks[$academicTermId])); | |
| unset($studentSemMark->subject); | |
| } | |
| if (empty($student)){ | |
| $student = json_decode(json_encode($studentObj[$studentId])); | |
| unset($student->semMarks); | |
| } | |
| $studentSemMark->supplyCredit = empty($studentSemMark->supplyCredit) ? 0 : $studentSemMark->supplyCredit; | |
| $student->id = $studentId; | |
| $student->name = $studentMark->student->studentName; | |
| $student->regNo = $studentMark->student->regNo; | |
| $student->examRegType = $studentMark->studentExamRegType; | |
| /** Subject's common details **/ | |
| $studentSubject->code = $examDetail->subject->subjectCode; | |
| $studentSubject->name = $examDetail->subject->subjectName; | |
| $studentSubject->desc = $examDetail->subject->subjectDesc; | |
| $studentSubject->syllabusCode = $examDetail->subject->syllabusCode; | |
| $studentSubject->subjectCatId = $examDetail->subject->subjectCatId; | |
| $studentSubject->excludeSubjectFromTotal = $examDetail->subject->excludeSubjectFromTotal; | |
| $studentSubject->credit = round ( $examDetail->subject->credit, 2 ); | |
| $studentSubject->subjectOrder = $examDetail->subject->subjectOrder; | |
| /** Subject's common details ends here */ | |
| $studentSubject->id = $academicPaperSubjectId; | |
| $studentSubject->isExempted = $studentMark->isExempted; | |
| $studentSubject->isAbsent = $studentMark->externalAttendanceStatus; | |
| $studentSubject->isInternal = $examDetail->subject->isInternal; | |
| $studentSubject->isInternalAbsent = $studentMark->internalAttendanceStatus; | |
| $studentSubject->isExternal = $examDetail->subject->isExternal; | |
| $studentSubject->supplyExamId = $examDetail->id; | |
| if ( $examDetail->subject->isInternal == 1 ) { | |
| $internalMark = round ( $studentMark->internalMark, 2 ); | |
| $internalMaxMark = round ( $examDetail->internalMaxMark, 2 ); | |
| $studentSubject->internalMark = $internalMark; | |
| $studentSubject->internalMaxMark = $internalMaxMark; | |
| $studentExamTotal += $internalMark; | |
| $examTotal += $internalMaxMark; | |
| } | |
| if ( $examDetail->subject->isExternal == 1 ) { | |
| $externalMark = round ( $studentMark->externalMark, 2); | |
| $externalMaxMark = round ( $examDetail->externalMaxMark, 2 ); | |
| $studentExamTotal += $externalMark; | |
| $examTotal += $externalMaxMark; | |
| $studentSubject->externalMark = $externalMark; | |
| $studentSubject->graceMark = $regularSubjectDetails->graceMark; | |
| $studentSubject->externalMaxMark = $externalMaxMark; | |
| } | |
| $studentExamTotal = ceil($studentExamTotal); | |
| $studentSubject->totalMark = $studentExamTotal; | |
| if($request->studentLowPassApplications[$studentId]->subjects[$academicPaperSubjectId]){ | |
| //do nothing | |
| $percentageObtained = $maxGradePercent * $studentExamTotal / $examTotal; | |
| $percentageObtained = round($percentageObtained, 2); | |
| } | |
| else if ( $isFailed ) { | |
| $percentageObtained = 0; | |
| } else { | |
| $percentageObtained = $maxGradePercent * $studentExamTotal / $examTotal; | |
| $percentageObtained = round($percentageObtained, 2); | |
| } | |
| $grade = $this->getGradeByPercentage($percentageObtained, $gradeDetails); | |
| if($request->studentLowPassApplications[$studentId]->subjects[$academicPaperSubjectId]){ | |
| $grade->gradePoint = 4; | |
| $grade->failStatus = 0; | |
| $isFailed = 0; | |
| $grade->letterGrade = "LP"; | |
| } | |
| $internalMarkPer = $externalMarkPer = 0; | |
| if (!empty ($grade)) { | |
| $creditGradePoint = ($examDetail->subject->credit * $grade->gradePoint); | |
| if ($grade->failStatus == 1) { | |
| $isFailed = 1; | |
| } | |
| $studentSubject->grade = $grade->letterGrade; | |
| $studentSubject->class = $grade->className; | |
| $studentSubject->gradePoint = round ( $grade->gradePoint, 2 ); | |
| $studentSubject->creditGradePoint = round ( $creditGradePoint, 2 ); | |
| $studentSubject->creditxMark = round ( $examDetail->subject->credit * $studentExamTotal, 2 ); | |
| } | |
| else { | |
| $studentSubject->grade = ""; | |
| $studentSubject->class = ""; | |
| $studentSubject->gradePoint = 0; | |
| $studentSubject->creditGradePoint = 0; | |
| } | |
| $studentSubject->totalMaxMark = $examTotal; | |
| $studentSubject->isFailed = $isFailed; | |
| $studentSubject->internalGradePoint = $internalMarkPer; | |
| $studentSubject->externalGradePoint = $externalMarkPer; | |
| $studentSemMark->isFailed = $isFailed ? 1 : (empty($studentSemMark->isFailed) ? 0 : $studentSemMark->isFailed); | |
| $studentSemMark->regularExamRegId = $examDetail->regularExamRegId; | |
| $studentSemMark->supplyCredit += $studentSubject->credit; | |
| $student->isFailed = $isFailed ? 1 : (empty($student->isFailed) ? 0 : $student->isFailed); | |
| $studentSemMark->subject[$academicPaperSubjectId] = $studentSubject; | |
| $student->semMarks[$academicTermId] = $studentSemMark; | |
| $students[$studentId] = $student; | |
| } | |
| } | |
| $completedStatus = "COMPLETED"; | |
| $incompleteStatus = "INCOMPLETE"; | |
| $failStatus = "FAIL"; | |
| foreach ( $students as $student ) { | |
| $sgpa = null; | |
| $studentId = $student->id; | |
| $semId = $request->semId; | |
| $student->sgpa = ''; | |
| $studentOverallMarkReport = $studentObj[$studentId]; | |
| /** Case when the student passed in all the written supply **/ | |
| if ( !$student->isFailed ) { | |
| /** | |
| * Here we are considering the mark details of 1 semester | |
| * So, total arrears will be the no. of arrears in that sem | |
| */ | |
| if ( $studentObj[$studentId]->totalArrears > 0 || $studentObj[$studentId]->isFailed ) { | |
| $student->status = $incompleteStatus; | |
| } | |
| else { | |
| $student->status = $completedStatus; | |
| if ($examYear < $studentObj[$studentId]->lastExamYear) { | |
| $student->status = $incompleteStatus; | |
| } | |
| else if ($examYear == $studentObj[$studentId]->lastExamYear && $examMonth < | |
| $studentObj[$studentId]->lastExamMonth) { | |
| $student->status = $incompleteStatus; | |
| } | |
| else { | |
| $sgpa = round($studentObj[$studentId]->semMarks[$academicTermId]->sgpa, 2); | |
| $student->semMarks[$academicTermId]->sgpa = $sgpa; | |
| $student->sgpa = $sgpa; | |
| } | |
| } | |
| } | |
| else { | |
| $student->status = $failStatus; | |
| } | |
| $student->semMarks[$academicTermId]->grade = $studentOverallMarkReport->semMarks[$academicTermId]->grade; | |
| $student->semMarks[$academicTermId]->class = $studentOverallMarkReport->semMarks[$academicTermId]->class; | |
| $student->semMarks[$academicTermId]->credit = $studentOverallMarkReport->semMarks[$academicTermId]->credit; | |
| $student->semMarks[$academicTermId]->creditGradePoint = $studentOverallMarkReport->semMarks[$academicTermId]->creditGradePoint; | |
| $student->semMarks[$academicTermId]->gradePoint = $studentOverallMarkReport->semMarks[$academicTermId]->gradePoint; | |
| $student->semMarks[$academicTermId]->supplyCreditGradePoint = array_sum(array_column($student->semMarks[$academicTermId]->subject, "creditGradePoint")); | |
| $student->semMarks[$academicTermId]->supplyGradePoint = array_sum(array_column($student->semMarks[$academicTermId]->subject, "gradePoint")); | |
| $student->semMarks[$academicTermId]->supplyTotalMarks = array_sum(array_column($student->semMarks[$academicTermId]->subject, "totalMark")); | |
| $student->semMarks[$academicTermId]->supplyTotalMaxMarks = array_sum(array_column($student->semMarks[$academicTermId]->subject, "totalMaxMark")); | |
| $student->semMarks[$academicTermId]->supplyCreditxMarks = array_sum(array_column($student->semMarks[$academicTermId]->subject, "creditxMark")); | |
| $student->overAllMarkDetails = $studentOverallMarkReport; | |
| $student->semMarks[$academicTermId]->supplyRegularTotalMarks = array_sum(array_column($studentOverallMarkReport->semMarks[$academicTermId]->subject, "totalMark")); | |
| $student->semMarks[$academicTermId]->supplyRegularGradePoint = array_sum(array_column($studentOverallMarkReport->semMarks[$academicTermId]->subject, "gradePoint")); | |
| } | |
| usort($students, function ($a, $b) { | |
| return $a->regNo > $b->regNo; | |
| }); | |
| } | |
| $details = new \stdClass(); | |
| $details->students = $students; | |
| return $details->students; | |
| } | |
| public function recalculateForExceptionalCase ( $currentExamSubjects, $revalutionRequest ) { | |
| $earnedCreditPoint = 0; | |
| $isFailed = 0; | |
| $subjectHistory = []; | |
| foreach($currentExamSubjects as $examSubject){ | |
| foreach($examSubject->consolidated->markHistory as $subjectMarkHistory){ | |
| if ( $examSubject->examYear."-".date("m", mktime(0, 0, 0, (int)$examSubject->examMonth, 10)) <= $revalutionRequest->examYear."-".date("m", mktime(0, 0, 0, (int)$revalutionRequest->examMonth, 10) )){ | |
| if ($revalutionRequest->subjects[$subjectMarkHistory->assessmentId]){ | |
| $subjectMarkHistory->creditGradePoint = $revalutionRequest->subjects[$subjectMarkHistory->assessmentId]->withoutRevaluationCreditGradePoint; | |
| $subjectMarkHistory->resultStatus = $revalutionRequest->subjects[$subjectMarkHistory->assessmentId]->withoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
| } | |
| if($subjectHistory[$examSubject->id]){ | |
| if($subjectHistory[$examSubject->id]->creditGradePoint < $subjectMarkHistory->creditGradePoint){ | |
| if($examSubject->excludeSubjectFromTotal != 1){ | |
| $earnedCreditPoint += ($subjectMarkHistory->creditGradePoint - $subjectHistory[$examSubject->id]->creditGradePoint); | |
| $subjectHistory[$examSubject->id] = $subjectMarkHistory; | |
| $isFailed = $subjectMarkHistory->resultStatus == "FAILED" ? 1 : $isFailed; | |
| } | |
| } | |
| } | |
| else{ | |
| if($examSubject->excludeSubjectFromTotal != 1){ | |
| $earnedCreditPoint += $subjectMarkHistory->creditGradePoint; | |
| $subjectHistory[$examSubject->id] = $subjectMarkHistory; | |
| $isFailed = $subjectMarkHistory->resultStatus == "FAILED" ? 1 : $isFailed; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| $revaluationResponse = new \stdClass(); | |
| $revaluationResponse->earnedCreditPoint = $earnedCreditPoint; | |
| $revaluationResponse->isFailed = $isFailed; | |
| return $revaluationResponse; | |
| } | |
| } | |
| function getProjectCredits($batchStartYear){ | |
| $credit = 6; | |
| if($batchStartYear >= 2022){ | |
| $credit = 11; | |
| } | |
| return $credit; | |
| } | |