From fd64685504a2c852db94528af84daf4925d330ff Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 8 Jun 2016 12:26:54 +1000 Subject: [PATCH] change logic --- booking.studygroups_report.inc | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/booking.studygroups_report.inc b/booking.studygroups_report.inc index 603aa6a..c6de556 100644 --- a/booking.studygroups_report.inc +++ b/booking.studygroups_report.inc @@ -114,10 +114,11 @@ function booking_studygroups_leadhelp_view_summary() { //get study group definitions $query = db_select('booking_studygroup_list', 's') ->fields('s') - ->condition('s.booking_eventid', $event->eid, '='); - $result = $query->execute(); + ->condition('s.booking_eventid', $event->eid, '=') + ->orderBy('sid'); + $studygroup_list = $query->execute(); - foreach ($result as $group) { + foreach ($studygroup_list as $group) { $header[] = $group->booking_studygroup_descrip; } @@ -129,17 +130,27 @@ function booking_studygroups_leadhelp_view_summary() { $group_mapping = $query->execute()->fetchAllAssoc('sid'); watchdog('booking_debug', "
Leader Helper studygroup query result\n@info
", array('@info' => print_r( $group_mapping, true))); - /* - foreach ($group_mapping as $group) { - $header[] = $group->booking_studygroup_descrip; - } - */ $person_query = db_query("SELECT * FROM {booking_person_view} WHERE booking_gender = 'M' ORDER BY booking_lastname, booking_firstname")->fetchAllAssoc('nid'); foreach ($person_query as $person) { //add the name to an array for this line $newline = array($person->booking_firstname, $person->booking_lastname); + + foreach ($studygroup_list as $group) { + $session = 'session' . $group->sid + $session_role = 'session' . $group->sid . '_role'; + + if ($person->$session_role > 0) { + $text = _booking_studygroup_role_lookup($person->$session_role); + $newline[] .= "" . $text . " for session #" . $group->booking_session_id; + } + else { + $newline[] = ""; + } + } + + /* //go through each of the studygroups and check if the person belongs to the group foreach ($group_mapping as $group) { $role = $group->booking_studygroup_role; @@ -151,6 +162,7 @@ function booking_studygroups_leadhelp_view_summary() { $newline[] = ""; } } + */ //add the line to the array of rows $rows[] = $newline; }