Skip to content

Commit

Permalink
Finished the ability to search for exams by category, date cuttoff, o…
Browse files Browse the repository at this point in the history
…r module
  • Loading branch information
paustian committed Jun 26, 2023
1 parent fc4cf61 commit 4e7b40c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,10 @@ public function examineall(Request $request) :Response {
$catName = $category->getCategory()->getName();
$questions = array_filter($questions, function($element) use ($catName){
$cat = $element->getCategories()->first();
//This happens when a category has not been picked.
if($cat === false){
return false;
}
$name = $cat->getCategory()->getName();
return ($catName === $name);
});
Expand Down Expand Up @@ -1569,6 +1573,7 @@ public function viewStudentsGrades(Request $request,
$currentGrade['id'] = $grade->getId();
$currentGrade['catagories'] = $grade->getCatagories();
$currentGrade['catagories'] = $currentGrade['catagories'][0];
$currentGrade['date'] = $grade->getDate();
$currentGrade['username'] = $userRepository->find($grade->getUid())->getUname();
$gradeArray[] = $currentGrade;
}
Expand Down Expand Up @@ -1625,6 +1630,13 @@ public function examineStudents(Request $request,
$catTopic = "";
}
$examTable = $gradeRepository->findExams((int)$student, $catTopic, $dateCut['datecutoff']);
if(count($examTable) < 1){
$this->addFlash('status', $this->trans('No students found with those parameters.'));
return $this->render('@PaustianQuickcheckModule/Admin/quickcheck_admin_examinestudents.html.twig',
['form' => $form->createView(),
'students' => $students,
'catArray' => $catArray]);
}
$averagePercent = 0;
//calculate the average score.
foreach($examTable as $index => $exam){
Expand Down

0 comments on commit 4e7b40c

Please sign in to comment.