Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 170 |
PseudoBatchService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 10 |
420.00 | |
0.00% |
0 / 170 |
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 7 |
|||
getPseudoBatchStudentDetailsByPseudoBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
getPseudoBatchStudentAssignmentMarks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
getPseudoBatchAssignmentSubjects | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 16 |
|||
getPseudoBatchExamSubjects | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 16 |
|||
getPseudoBatchStudentMarks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
getAttendanceDays | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
getIsAbsentValue | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getTotalWorkingHours | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getPseudoBatchDetailsByPseudoBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use com\linways\core\ams\professional\request\IsAbsentValueRequest; | |
use com\linways\core\ams\professional\request\AttendanceDaysRequest; | |
use com\linways\core\ams\professional\request\AttendanceHoursRequest; | |
use com\linways\core\ams\professional\request\AttendanceRulesRequest; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
use com\linways\core\ams\professional\request\PseudoBatchAssignmentListRequest; | |
use com\linways\core\ams\professional\request\PseudoBatchStudentMarkListRequest; | |
use com\linways\core\ams\professional\request\PseudoBatchExamSubjectsListRequest; | |
class PseudoBatchService extends BaseService | |
{ | |
// /Condition 1 - Presence of a static member variable | |
private static $_instance = null; | |
// private $mapper = []; | |
// /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; | |
} | |
public function getPseudoBatchStudentDetailsByPseudoBatchId($id) | |
{ | |
$id = $this->realEscapeString($id); | |
$studentList = []; | |
$sql = "SELECT sa.studentID, sa.rollNo, sa.studentName, | |
sa.studentEmail, sa.studentPhone, d.deptName, b.batchName,sa.batchID,sa.studentJoindate | |
FROM pseudobatches pb | |
INNER JOIN ps_relation pr ON pr.pseudobatchID = pb.pseudobatchID | |
INNER JOIN studentaccount sa ON sa.studentID = pr.studentID | |
INNER JOIN batches b ON b.batchID = sa.batchID | |
INNER JOIN department d ON d.deptID = pb.deptID | |
where pr.pseudobatchID=$id | |
ORDER BY sa.batchID ASC , sa.studentName ASC"; | |
try { | |
$studentList = $this->executeQueryForList($sql); | |
return $studentList; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getPseudoBatchStudentAssignmentMarks(PseudoBatchAssignmentListRequest $request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$assignmentMarkList = []; | |
$sql = "SELECT | |
st.studentID, | |
st.studentName, | |
b.batchID, | |
b.batchName, | |
GROUP_CONCAT('{\"assignmentID\":', am.assignmentID, | |
',\"assignmentMark\":', am.marksObtained, | |
',\"subjectID\":', bm.subjectID, | |
',\"maxMark\":',bm.max_mark, | |
'}') AS assignments | |
FROM | |
ps_relation ps | |
INNER JOIN studentaccount st ON st.studentID = ps.studentID | |
INNER JOIN batches b ON b.batchID = st.batchID | |
LEFT JOIN batch_assignment bm ON st.batchID = bm.batchID AND bm.semID = $request->semesterId AND bm.assiNu = $request->assignmentNumber | |
LEFT JOIN assignment_marks am on am.studentID = st.studentID and bm.assignmentID = am.assignmentID | |
WHERE | |
am.csID IS NULL AND ps.pseudobatchID = $request->pseudoBatchId | |
GROUP BY st.studentID | |
ORDER BY st.studentID"; | |
try { | |
$assignmentMarkList = $this->executeQueryForList($sql); | |
return $assignmentMarkList; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getPseudoBatchAssignmentSubjects(PseudoBatchAssignmentListRequest $request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$subjectBatchList = []; | |
$sql = "SELECT s.subjectName,b.batchName,bm.max_mark FROM ps_relation ps | |
INNER JOIN studentaccount st ON st.studentID = ps.studentID | |
INNER JOIN batches b ON b.batchID = st.batchID | |
INNER JOIN batch_assignment bm ON bm.batchID = st.batchID | |
INNER JOIN subjects s ON s.subjectID = bm.subjectID | |
where ps.pseudobatchID = $request->pseudoBatchId AND bm.semID = $request->semesterId and bm.assiNu = $request->assignmentNumber GROUP BY st.batchID,bm.subjectID ORDER BY s.subjectName"; | |
try { | |
$subjectBatchList = $this->executeQueryForList($sql); | |
return $subjectBatchList; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getPseudoBatchExamSubjects(PseudoBatchExamSubjectsListRequest $request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$subjectBatchList = []; | |
$sql = "SELECT exam.examID,exam.examTotalMarks,subj.subjectID,subj.subjectName FROM exam | |
INNER JOIN subjects subj ON subj.subjectID=exam.subjectID | |
INNER JOIN studentaccount sa ON sa.batchID=exam.batchID | |
INNER JOIN ps_relation pr ON pr.studentID=sa.studentID | |
where exam.examTypeID=$request->examTypeId AND pr.pseudobatchID= $request->pseudoBatchId | |
group by subj.subjectID"; | |
try { | |
$subjectBatchList = $this->executeQueryForList($sql); | |
return $subjectBatchList; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getPseudoBatchStudentMarks(PseudoBatchStudentMarkListRequest $request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$studentMarkList = []; | |
$sql = "SELECT sm.marksObtained, sm.percentage FROM subjects subj | |
INNER JOIN exam ON subj.subjectID = exam.subjectID | |
INNER JOIN student_marks sm ON exam.examID=sm.examID | |
INNER JOIN studentaccount sa ON sa.studentID=sm.studentID | |
where exam.examTypeID=$request->examTypeId AND sa.studentID=$request->studentId AND subj.subjectID=$request->subjectId"; | |
try { | |
$studentMarkList = $this->executeQueryForList($sql); | |
return $studentMarkList; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getAttendanceDays(AttendanceDaysRequest $request) | |
{ | |
//daywise | |
$request = $this->realEscapeObject($request); | |
$days = []; | |
$sql = "SELECT | |
attendanceDate | |
FROM | |
attendance | |
WHERE | |
semID = $request->semId AND batchID = $request->batchId | |
AND attendanceDate BETWEEN '$request->startDate' AND '$request->endDate' | |
GROUP BY attendanceDate | |
ORDER BY attendanceDate"; | |
try { | |
$days = $this->executeQueryForList($sql); | |
return $days; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getIsAbsentValue(IsAbsentValueRequest $request) | |
{ | |
//check | |
//daywise | |
$request = $this->realEscapeObject($request); | |
$value = ""; | |
$sql = "SELECT t1.isAbsent | |
FROM attendance t1 | |
WHERE t1.attendanceDate=$request->date | |
AND t1.batchID=$request->batchId | |
AND t1.hour=$request->->hour | |
AND t1.semID=$request->semId | |
AND t1.studentID=$request->->studentId"; | |
try { | |
$value = $this->executeQueryForList($sql); | |
return $value; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getTotalWorkingHours(AttendanceHoursRequest $request) | |
{ | |
//hourwise | |
$request = $this->realEscapeObject($request); | |
$count = ""; | |
$sql = "SELECT | |
COUNT(semID) | |
FROM | |
attendance | |
WHERE | |
semID = $request->semId AND studentID = $request->studentId | |
AND attendanceDate BETWEEN '$request->startDate' AND '$request->endDate'"; | |
try { | |
$count = $this->executeQueryForList($sql); | |
return $count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getPseudoBatchDetailsByPseudoBatchId($pseudosubjectID) | |
{ | |
$id = $this->realEscapeString($pseudosubjectID); | |
$studentList = []; | |
$sql = "SELECT subjectName as `name`, | |
pseudo_subject_type_id, | |
pseudo_subject_group_id | |
FROM pseudosubjects | |
WHERE pseudosubjectID=".$pseudosubjectID; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
} | |
//getAttendanceMarkedDates | |
//getAttendanceRule | |