Skip to content

Commit

Permalink
Crowd Assessment: fixed PHP query error for empty result sets
Browse files Browse the repository at this point in the history
  • Loading branch information
SKuipers committed Mar 3, 2025
1 parent afb6ad8 commit 8c9b888
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/Crowd Assessment/crowdAssess.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
$page->breadcrumbs->add(__('View All Assessments'));

$sql = getLessons($guid, $connection2);
if (empty($sql[0]) || empty($sql[1])) return;

$lessons = $pdo->select($sql[1], $sql[0])->fetchAll();
$unitGateway = $container->get(UnitGateway::class);

Expand Down
5 changes: 5 additions & 0 deletions modules/Crowd Assessment/crowdAssess_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
// Check existence of and access to this lesson.
$and = " AND gibbonPlannerEntryID=$gibbonPlannerEntryID";
$sql = getLessons($guid, $connection2, $and);

if (empty($sql[0]) || empty($sql[1])) return;

$lesson = $pdo->select($sql[1], $sql[0])->fetch();

if (empty($lesson)) {
Expand Down Expand Up @@ -73,6 +76,8 @@
$sqlList = getStudents($guid, $connection2, $role, $lesson['gibbonCourseClassID'], $lesson['homeworkCrowdAssessOtherTeachersRead'], $lesson['homeworkCrowdAssessOtherParentsRead'], $lesson['homeworkCrowdAssessSubmitterParentsRead'], $lesson['homeworkCrowdAssessClassmatesParentsRead'], $lesson['homeworkCrowdAssessOtherStudentsRead'], $lesson['homeworkCrowdAssessClassmatesRead']);

// DATA TABLE
if (empty($sqlList[0]) || empty($sqlList[1])) return;

$students = $pdo->select($sqlList[1], $sqlList[0])->fetchAll();
foreach ($students as $index => $student) {
$homework = $plannerHomeworkGateway->selectBy(['gibbonPlannerEntryID' => $gibbonPlannerEntryID, 'gibbonPersonID' => $student['gibbonPersonID']])->fetch();
Expand Down

0 comments on commit 8c9b888

Please sign in to comment.