Skip to content

Commit 4e7b40c

Browse files
committed
Finished the ability to search for exams by category, date cuttoff, or module
1 parent fc4cf61 commit 4e7b40c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Controller/AdminController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,10 @@ public function examineall(Request $request) :Response {
14281428
$catName = $category->getCategory()->getName();
14291429
$questions = array_filter($questions, function($element) use ($catName){
14301430
$cat = $element->getCategories()->first();
1431+
//This happens when a category has not been picked.
1432+
if($cat === false){
1433+
return false;
1434+
}
14311435
$name = $cat->getCategory()->getName();
14321436
return ($catName === $name);
14331437
});
@@ -1569,6 +1573,7 @@ public function viewStudentsGrades(Request $request,
15691573
$currentGrade['id'] = $grade->getId();
15701574
$currentGrade['catagories'] = $grade->getCatagories();
15711575
$currentGrade['catagories'] = $currentGrade['catagories'][0];
1576+
$currentGrade['date'] = $grade->getDate();
15721577
$currentGrade['username'] = $userRepository->find($grade->getUid())->getUname();
15731578
$gradeArray[] = $currentGrade;
15741579
}
@@ -1625,6 +1630,13 @@ public function examineStudents(Request $request,
16251630
$catTopic = "";
16261631
}
16271632
$examTable = $gradeRepository->findExams((int)$student, $catTopic, $dateCut['datecutoff']);
1633+
if(count($examTable) < 1){
1634+
$this->addFlash('status', $this->trans('No students found with those parameters.'));
1635+
return $this->render('@PaustianQuickcheckModule/Admin/quickcheck_admin_examinestudents.html.twig',
1636+
['form' => $form->createView(),
1637+
'students' => $students,
1638+
'catArray' => $catArray]);
1639+
}
16281640
$averagePercent = 0;
16291641
//calculate the average score.
16301642
foreach($examTable as $index => $exam){

0 commit comments

Comments
 (0)