Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 14
CRAP
0.00% covered (danger)
0.00%
0 / 277
StudentExamMarkSheetService
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 14
992.00
0.00% covered (danger)
0.00%
0 / 277
 __construct
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 3
 __clone
0.00% covered (danger)
0.00%
0 / 1
2.00
0.00% covered (danger)
0.00%
0 / 2
 getInstance
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 5
 getSupplyExamRegistrationsByBatchId
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 12
 getStudentsMarkSheetsUsingExamRegId
0.00% covered (danger)
0.00%
0 / 1
12.00
0.00% covered (danger)
0.00%
0 / 39
 getSubjectLists
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 20
 getStudentsMarkSheetsUsingExamRegIdForSupply
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 35
 getBatchDetailsByExamRegIdAndBatchId
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 13
 getSupplyExamSem
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 11
 getRegularExamMonthAndYear
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 11
 getSubjectGroups
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 14
 getSubjectListsForSupply
0.00% covered (danger)
0.00%
0 / 1
6.00
0.00% covered (danger)
0.00%
0 / 35
 getStudentConsolidatedMarkDetails
0.00% covered (danger)
0.00%
0 / 1
30.00
0.00% covered (danger)
0.00%
0 / 65
 getStudentCourseConsolidatedMarkDetail
0.00% covered (danger)
0.00%
0 / 1
12.00
0.00% covered (danger)
0.00%
0 / 12
<?php
namespace com\linways\core\ams\professional\service;
use com\linways\core\ams\professional\mapper\StudentExamMarkSheetServiceMapper;
// use com\linways\core\ams\professional\exception\ProfessionalException;
use com\linways\core\ams\professional\dto\Subject;
use com\linways\core\ams\professional\dto\ExamType;
use com\linways\core\ams\professional\dto\ExamSubject;
use com\linways\core\ams\professional\request\DeleteExcludedStudentRequest;
use com\linways\core\ams\professional\util\CommonUtil;
use com\linways\core\ams\professional\dto\SettingsConstents;
use com\linways\core\ams\professional\service\CommonService;
use com\linways\core\ams\professional\dto\ExamEnrollmentFees;
use com\linways\core\ams\professional\dto\FailedStudentCount;
use com\linways\core\ams\professional\service\StudentService;
use com\linways\core\ams\professional\constant\BatchConstants;
use com\linways\core\ams\professional\dto\UniversityExamMarks;
use com\linways\core\ams\professional\mapper\ExamServiceMapper;
use com\linways\core\ams\professional\service\nba\NbaCoService;
use com\linways\core\ams\professional\dto\StudentWiseFailedRate;
use com\linways\core\ams\professional\dto\SubjectWiseFailedRate;
use com\linways\core\ams\professional\service\CourseTypeService;
use com\linways\core\ams\professional\constant\SettingsConstants;
use com\linways\core\ams\professional\dto\SlowLearnerIdentification;
use com\linways\core\ams\professional\request\GetExamDetailsRequest;
use com\linways\core\ams\professional\exception\ProfessionalException;
use com\linways\core\ams\professional\response\GetExamTimeTablesResponse;
use com\linways\core\ams\professional\response\GetYearOutStudentResponse;
use com\linways\core\ams\professional\request\AddStudentPassoutYearRequest;
use com\linways\core\ams\professional\constant\ExamType as ExamTypeConstant;
use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants;
use com\linways\core\ams\professional\constant\examcontroller\ExamSubjectTypeConstants;
use com\linways\core\ams\professional\request\examcontroller\ConsolidatedMarkReportRequest;
use com\linways\core\ams\professional\dto\examcontroller\UniversityMarkListPassPercentConfig;
use com\linways\core\ams\professional\service\examcontroller\finalMarkList\ConsolidatedMarkReportService;
use com\linways\core\ams\professional\mapper\InternalExamMapper;
use com\linways\core\ams\professional\service\AttendanceService;
use com\linways\base\util\SecurityUtils;
use com\linways\core\ams\professional\service\SubjectService;
class StudentExamMarkSheetService extends BaseService
{
    // private $batchService = BatchService::getInstance();
    // /Condition 1 - Presence of a static member variable
    private static $_instance = null;
    private $mapper = [];
    // /Condition 2 - Locked down the constructor
    private function __construct()
    {
        $this->studentMarkSheetMapper = StudentExamMarkSheetServiceMapper::getInstance()->getMapper();
    }
    // Prevent any oustide instantiation of this class
    // /Condition 3 - Prevent any object or instance of that class to be cloned
    private function __clone()
    {
    }
    // Prevent any copy of this object
    // /Condition 4 - Have a single globally accessible static method
    public static function getInstance()
    {
        if (!is_object(self::$_instance)) // or if( is_null(self::$_instance) ) or if( self::$_instance == null )
            self::$_instance = new self();
        return self::$_instance;
    }
       /**
     * @param $batchId
     * @return array|Object
     * @throws ProfessionalException
     * @author Aiswarya v
     */
    public function getSupplyExamRegistrationsByBatchId($batchId)
    {
        $batchId = $this->realEscapeString($batchId);
        $supplyExamRegs = [];
        $sql = "SELECT DISTINCT es.id, es.supplyDesc as name, es.examMonth, es.examYear FROM exam_supplementary es INNER JOIN supply_improve_batches sib ON (es.id= sib
  .exam_supplementary_id) INNER JOIN batches b ON (sib.batchID = b.batchID) WHERE b.batchId = '$batchId";
        try {
            $supplyExamRegs = $this->executeQueryForList($sql);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(), $e->getMessage());
        }
        return $supplyExamRegs;
    }
           /**
     * @param $batchId
     * @return array|Object
     * @throws ProfessionalException
     * @author Aiswarya v
     */
    public function getStudentsMarkSheetsUsingExamRegId($request)
    {
        $examRegId = $this->realEscapeString($request->examRegId);
        $batchId = $this->realEscapeString($request->batchId);
        $semId = $this->realEscapeString($request->semId);
        $examType = $this->realEscapeString($request->examType);
        $excludeFailedBatch = "";
        if(!$request->includeFailedBatch){
            $excludeFailedBatch = "AND  t1.batchID in (select batchID from batches fb where fb.batchName !='failed')";
        }
        $studentLists = [];
        $sql = "SELECT t1.studentID,t1.regNo,t1.studentName,sub.subjectID, sub.subjectDesc ,sub.subjectName,subgrp.code as subjectGroupCode ,subgrp.name as subjectGroupName,ec.*,ecsem.total_marks as semTotal,ecsem.mark_details as semesterMarkDetails,ecsem.percentage as semPercentage,ecsem.status as semStatus 
        FROM failed_students fs 
        inner join studentaccount t1 on t1.studentID = fs.studentID $excludeFailedBatch
        inner join batches b on t1.batchID = b.batchID 
        inner join exam_reg_studentchallan t2 ON t1.studentID = t2.studentID and t2.examregID = $examRegId
        inner join exam_reg_studentsubject t3 on t2.examregID = t3.examregID AND t2.studentID = t3.studentID 
        left join  ec_subject_consolidated_mark_details ec on ec.student_id = t1.studentID and ec.batch_id = fs.previousBatch and JSON_CONTAINS(ec.mark_history, '{\"examRegId\" : \"$examRegId\"}') and JSON_CONTAINS(ec.mark_history, '{\"examMarkType\" : \"$examType\"}')  
        left join subjects sub on ec.subject_id = sub.subjectID 
        left join subjectGroups_subjects grp on sub.subjectID = grp.subjects_id  and grp.batches_id = fs.previousBatch  
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id  
        left join ec_semster_consolidated_mark_details ecsem on ecsem.student_id = t1.studentID and ecsem.batch_id = fs.previousBatch and ecsem.sem_id = ec.sem_id where  fs.previousBatch = $batchId and  fs.failedInSemester > '$semId' AND FIND_IN_SET('$semId', fs.hisSemestersInThisbatch)  
        union
        SELECT s.studentID,s.regNo,s.studentName,sub.subjectID, sub.subjectDesc ,sub.subjectName,subgrp.code as subjectGroupCode ,subgrp.name as subjectGroupName,ec.*,ecsem.total_marks as semTotal,ecsem.mark_details as semesterMarkDetails,ecsem.percentage as semPercentage,ecsem.status as semStatus 
        FROM studentaccount s 
        inner join batches b on s.batchID=b.batchID 
        inner join exam_reg_studentchallan t2 ON s.studentID = t2.studentID and t2.examregID = $examRegId
        inner join exam_reg_studentsubject t3 on t2.examregID = t3.examregID AND t2.studentID = t3.studentID left join  ec_subject_consolidated_mark_details ec on ec.student_id = s.studentID and ec.batch_id = s.batchID  and JSON_CONTAINS(ec.mark_history, '{\"examRegId\" : \"$examRegId\"}') and JSON_CONTAINS(ec.mark_history, '{\"examMarkType\" : \"$examType\"}')  
        left join subjects sub on ec.subject_id = sub.subjectID 
        left join subjectGroups_subjects grp on sub.subjectID = grp.subjects_id  and grp.batches_id = s.batchID 
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id  
        left join ec_semster_consolidated_mark_details ecsem on ecsem.student_id = s.studentID and ecsem.batch_id = s.batchID and ecsem.sem_id = ec.sem_id where  s.batchID = $batchId 
        ORDER BY regNo ASC";
        try {
            $studentLists = $this->executeQueryForList($sql, $this->studentMarkSheetMapper[StudentExamMarkSheetServiceMapper::GET_STUDENTS_MARK_SHEET]);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(), $e->getMessage());
        }
        return $studentLists;
    }
           /**
     * @param $batchId
     * @return array|Object
     * @throws ProfessionalException
     * @author Aiswarya v
     */
    public function getSubjectLists($request)
    {
        $examRegId = $this->realEscapeString($request->examRegId);
        $batchId = $this->realEscapeString($request->batchId);
        $examType = $this->realEscapeString($request->examType);
        $semId = $this->realEscapeString($request->semId);
        $subjectLists = [];
        $sql = "SELECT t1.*, t2.subjectID, t2.subjectName, t2.subjectDesc,subgrp.code as subjectGroupCode from 
        exam_subjectcredit t1 
        inner join subjects t2  on t1.subjectID=t2.subjectID 
        left join subjectGroups_subjects grp on t2.subjectID = grp.subjects_id  and grp.batches_id = t1.batchID and grp.semesters_id = t1.semID
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id 
        where t1.batchID=\"".$batchId."\" and t1.semID=\"".$semId."\"
        order by t1.subjectOrder ASC";
        try {
            $subjectLists = $this->executeQueryForList($sql);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(), $e->getMessage());
        }
        return $subjectLists;
    }
            /**
     * @param $batchId
     * @return array|Object
     * @throws ProfessionalException
     * @author Aiswarya v
     */
    public function getStudentsMarkSheetsUsingExamRegIdForSupply($request)
    {
        $examRegId = $this->realEscapeString($request->examRegId);
        $batchId = $this->realEscapeString($request->batchId);
        $semId = $this->realEscapeString($request->semId);
        $examType = $this->realEscapeString($request->examType);
        $studentLists = [];
        $sql = "SELECT t1.studentID,t1.regNo,t1.studentName,sub.subjectID, sub.subjectDesc ,sub.subjectName,subgrp.code as subjectGroupCode ,subgrp.name as subjectGroupName,ec.*,ecsem.total_marks as semTotal,ecsem.mark_details as semesterMarkDetails,ecsem.percentage as semPercentage,ecsem.status as semStatus 
        FROM failed_students fs 
        inner join studentaccount t1 on t1.studentID = fs.studentID and t1.batchID in (select batchID from batches fb where fb.batchName !='failed')
        inner join batches b on fs.previousBatch =b.batchID 
        inner join exam_supplementary_student_details t3 on t1.studentID=t3.studentID and t3.paid=1 and  t3.exam_supplementary_id=$examRegId
        left join  ec_subject_consolidated_mark_details ec on ec.student_id = t1.studentID   and JSON_CONTAINS(ec.mark_history, '{\"examRegId\" : \"$examRegId\"}') and JSON_CONTAINS(ec.mark_history, '{\"examMarkType\" : \"$examType\"}')    
        left join subjects sub on ec.subject_id = sub.subjectID 
        left join subjectGroups_subjects grp on sub.subjectID = grp.subjects_id  and grp.batches_id = fs.previousBatch  
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id  
        left join ec_semster_consolidated_mark_details ecsem on ecsem.student_id = t1.studentID and ecsem.batch_id = fs.previousBatch  and ecsem.sem_id = ec.sem_id
         where  fs.previousBatch = $batchId and  fs.failedInSemester > '$semId' AND FIND_IN_SET('$semId', fs.hisSemestersInThisbatch)  
        UNION
        SELECT s.studentID,s.regNo,s.studentName,sub.subjectID, sub.subjectDesc ,sub.subjectName,subgrp.code as subjectGroupCode ,subgrp.name as subjectGroupName,ec.*,ecsem.total_marks as semTotal,ecsem.mark_details as semesterMarkDetails,ecsem.percentage as semPercentage,ecsem.status as semStatus 
        FROM studentaccount s 
        inner join batches b on s.batchID=b.batchID 
        inner join exam_supplementary_student_details t1 on t1.studentID=s.studentID and t1.paid=1 and   t1.exam_supplementary_id=$examRegId
        left join  ec_subject_consolidated_mark_details ec on ec.student_id = s.studentID  and JSON_CONTAINS(ec.mark_history, '{\"examRegId\" : \"$examRegId\"}') and JSON_CONTAINS(ec.mark_history, '{\"examMarkType\" : \"$examType\"}')    
        left join subjects sub on ec.subject_id = sub.subjectID 
        left join subjectGroups_subjects grp on sub.subjectID = grp.subjects_id  and grp.batches_id = s.batchID 
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id  
        left join ec_semster_consolidated_mark_details ecsem on ecsem.student_id = s.studentID and ecsem.batch_id = s.batchID and ecsem.sem_id = ec.sem_id where  s.batchID = $batchId 
        ORDER BY regNo ASC";
        try {
            $studentLists = $this->executeQueryForList($sql, $this->studentMarkSheetMapper[StudentExamMarkSheetServiceMapper::GET_STUDENTS_MARK_SHEET]);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(), $e->getMessage());
        }
        return $studentLists;
    }
            /**
     * @param $batchId .$examRegId
     * @return array|Object 
     * @throws ProfessionalException
     * @author Aiswarya v
     */
    public function getBatchDetailsByExamRegIdAndBatchId($request)
    {
        $examRegId = $this->realEscapeString($request->examRegId);
        $batchId = $this->realEscapeString($request->batchId);
        $examType = $this->realEscapeString($request->examType);
        $batchDetails = null;
        $sql = "SELECT * FROM exam_registration_batches WHERE examregID = $examRegId AND batchID = $batchId ";
      
        try {
            $batchDetails = $this->executeQueryForObject($sql);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(), $e->getMessage());
        }
        return $batchDetails;
    }
    /**
     * Method for getting supply exam month nd year by supplyexam reg id
     * @throws ProfessionalException
     * @return Object
     * @author Aiswarya
     */
    public function getSupplyExamSem($supplyExamRegId)
    {
        $supplyExamDetails="";
        $supplyExamRegId = $this->realEscapeString($supplyExamRegId);
        try{
            $sql = "SELECT * from exam_supplementary where id='$supplyExamRegId'";
            $supplyExamDetails = $this->executeQueryForObject($sql);      
        }catch (\Exception $e){
            throw new ProfessionalException($e->getCode(),$e->getMessage());
            
        }
        
        return $supplyExamDetails;
    }
   
    public function getRegularExamMonthAndYear($examregID)
    {
        $regularExamDetails="";
        $examregID = $this->realEscapeString($examregID);
        try{
            $sql = "SELECT examMonth,examYear FROM exam_registration WHERE examregID = ".$examregID."";
            $regularExamDetails = $this->executeQueryForObject($sql);      
        }catch (\Exception $e){
            throw new ProfessionalException($e->getCode(),$e->getMessage());
            
        }
        
        return $regularExamDetails;
    }
    public function getSubjectGroups($batchId,$semId)
    {
        $sql = null;
        $batchId = $this->realEscapeString($batchId);
        $semId = $this->realEscapeString($semId);
        $subjectGroups = [];
        try{
            $sql = "SELECT ersc.*,t2.subjectGroups_id AS groupId,t3.code,t3.name,t1.subjectName,t1.subjectDesc,t1.subjectID,t1.subjectPriority,ersc.subjectOrder,ersc.subjectType FROM subjects t1 INNER JOIN subjectGroups_subjects t2 ON t1.subjectID = t2.subjects_id LEFT JOIN subjectGroups t3 ON t2.subjectGroups_id = t3.id INNER JOIN exam_subjectcredit ersc ON ersc.batchID = t2.batches_id AND ersc.semID = t2.semesters_id AND t2.subjects_id = ersc.subjectID WHERE 
            t2.batches_id = $batchId AND t2.semesters_id = $semId  ORDER BY subjectOrder ASC;";
            $subjectGroups = $this->executeQueryForList($sql, $this->studentMarkSheetMapper[StudentExamMarkSheetServiceMapper::GET_SUBJECT_GROUPS]);
            
        }catch( \Exception $e){
            throw new AutonomousException($e->getCode(),$e->getMessage());
        }
        return $subjectGroups;
    }
      /**
     * @param $batchId
     * @return array|Object
     * @throws ProfessionalException
     * @author Aiswarya v
     */
    public function getSubjectListsForSupply($request)
    {
        $examRegId = $this->realEscapeString($request->examRegId);
        $batchId = $this->realEscapeString($request->batchId);
        $examType = $this->realEscapeString($request->examType);
        $semId = $this->realEscapeString($request->semId);
        $subjectLists = [];
        $sql = "SELECT sub.subjectID, sub.subjectDesc ,sub.subjectName,subgrp.code as subjectGroupCode ,subgrp.name as subjectGroupName,ec.*,ecre.* FROM failed_students fs 
        inner join studentaccount t1 on t1.studentID = fs.studentID and  t1.batchID in (select batchID from batches fb where fb.batchName !='failed')
        inner join batches b on t1.batchID=b.batchID 
        inner join exam_supplementary_student_details t3 on t1.studentID=t3.studentID and t3.paid=1 and  t3.exam_supplementary_id=$examRegId
        left join  ec_subject_consolidated_mark_details ec on ec.student_id = t1.studentID   and JSON_CONTAINS(ec.mark_history, '{\"examRegId\" : \"$examRegId\"}') and JSON_CONTAINS(ec.mark_history, '{\"examMarkType\" : \"$examType\"}')    
        inner join subjects sub on ec.subject_id = sub.subjectID 
        left join subjectGroups_subjects grp on sub.subjectID = grp.subjects_id  and grp.batches_id = fs.previousBatch 
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id  
        left join ec_semster_consolidated_mark_details ecsem on ecsem.student_id = t1.studentID and ecsem.batch_id = fs.previousBatch  and ecsem.sem_id = ec.sem_id
         left join exam_subjectcredit ecre on ecre.subjectID = sub.subjectID and ecre.batchID = fs.previousBatch and ecre.semID = $semId where  fs.previousBatch = $batchId and  fs.failedInSemester > '$semId' AND FIND_IN_SET('$semId', fs.hisSemestersInThisbatch)  
        UNION
        SELECT sub.subjectID, sub.subjectDesc ,sub.subjectName,subgrp.code as subjectGroupCode ,subgrp.name as subjectGroupName,ec.*,ecre.*  
        FROM studentaccount s 
        inner join batches b on s.batchID=b.batchID 
        inner join exam_supplementary_student_details t1 on t1.studentID=s.studentID and t1.paid=1 and   t1.exam_supplementary_id=$examRegId
        left join  ec_subject_consolidated_mark_details ec on ec.student_id = s.studentID   and JSON_CONTAINS(ec.mark_history, '{\"examRegId\" : \"$examRegId\"}') and JSON_CONTAINS(ec.mark_history, '{\"examMarkType\" : \"$examType\"}')    
        inner join subjects sub on ec.subject_id = sub.subjectID 
        left join subjectGroups_subjects grp on sub.subjectID = grp.subjects_id  and grp.batches_id = s.batchID 
        left join subjectGroups subgrp on subgrp.id = grp.subjectGroups_id  
        left join ec_semster_consolidated_mark_details ecsem on ecsem.student_id = s.studentID and ecsem.batch_id = s.batchID and ecsem.sem_id = ec.sem_id 
        left join exam_subjectcredit ecre on ecre.subjectID = sub.subjectID and ecre.batchID = s.batchID and ecre.semID = $semId where  s.batchID = $batchId 
";
        try {
            $subjectLists = $this->executeQueryForList($sql, $this->studentMarkSheetMapper[StudentExamMarkSheetServiceMapper::GET_SUBJECT_LISTS]);
        } catch (\Exception $e) {
            throw new ProfessionalException($e->getCode(), $e->getMessage());
        }
        return $subjectLists;
    }
    public function getStudentConsolidatedMarkDetails ($consolidatedMarkDetails){
        $consolidatedMarkDetails = $this->realEscapeObject($consolidatedMarkDetails);
        $cond = "";
        $sql = "SELECT 
                    ecsem.student_id AS studentID,
                    sa.studentName,
                    sa.regNo,
                    ecsem.mark_details AS semesterMarkDetails,
                    ecsem.no_of_arrears,
                    ecsem.total_supply_attempt_count,
                    ecsem.total_marks AS semTotal,
                    ecsem.percentage AS semPercentage,
                    ecsem.grade AS semGrade,
                    ecsem.class AS semClass,
                    ecsem.sgpa AS semSgpa,
                    ecsem.status AS semStatus,
                    ecsub.subject_id AS subjectID,
                    s.subjectName,
                    s.subjectDesc,
                    s.subjectPriority,
                    ecsub.id,
                    ecsub.subject_category_id,
                    sc.subjectcatID,
                    sc.subjectcatName, 
                    sc.show_in_sem_term_reg,
                    ecsub.mark_details,
                    ecsub.mark_history,
                    ecsub.no_of_chances_taken,
                    ecsub.total_marks,
                    ecsub.percentage,
                    ecsub.grade,
                    ecsub.grade_point,
                    ecsub.credit_grade_point,
                    ecsub.status,
                    ecsub.class,
                    esc.credit AS credit,
                    esc.excludeSubjectFromTotal
                FROM
                    ec_semster_consolidated_mark_details ecsem
                        INNER JOIN
                    ec_subject_consolidated_mark_details ecsub ON ecsub.student_id = ecsem.student_id
                        AND ecsub.sem_id = ecsem.sem_id
                        INNER JOIN
                    subjects s ON s.subjectID = ecsub.subject_id
                        INNER JOIN
                    semesters sem ON sem.semID = ecsem.sem_id
                        INNER JOIN
                    studentaccount sa ON sa.studentID = ecsem.student_id
                        INNER JOIN
                    exam_subjectcredit esc ON esc.subjectID = ecsub.subject_id 
                        AND esc.semID = ecsub.sem_id AND esc.batchID = ecsub.batch_id
                        LEFT JOIN 
                    subject_category sc ON sc.subjectcatID = s.subjectcatID
                WHERE 1 = 1";
        try{
            $cond .= $consolidatedMarkDetails->semId?" AND ecsem.sem_id = '$consolidatedMarkDetails->semId'":"";
            $cond .= $consolidatedMarkDetails->studentId?" AND ecsem.student_id = '$consolidatedMarkDetails->studentId'":"";
            $cond .= $consolidatedMarkDetails->subjectId?" AND ecsub.subject_id = '$consolidatedMarkDetails->subjectId'":"";
            $sql .= $cond;
            $studentSemConsolidated = $this->executeQueryForList($sql,$this->studentMarkSheetMapper[StudentExamMarkSheetServiceMapper::GET_STUDENTS_MARK_SHEET]);
            return $studentSemConsolidated;
        }
        catch(\Exception $e) {
            throw new ProfessionalException($e->getCode(),$e->getMessage());
        }
    }
    public function getStudentCourseConsolidatedMarkDetail($request){
        $request = $this->realEscapeObject($request);
        $cond = "";
        $sql = "SELECT ecm.student_id,ecm.percentage, ecm.cgpa, ecm.total_marks,ecm.status from ec_course_consolidated_mark_details ecm WHERE 1=1";
        try{
            $cond .= $request->studentId?" AND ecm.student_id = '$request->studentId'":"";
            $studentConsolidatedMark = $this->executeQueryForList($sql);
            return $studentConsolidatedMark;
        }
        catch(\Exception $e) {
            throw new ProfessionalException($e->getCode(),$e->getMessage());
        }
    }
}
?>