From 963bebdd41de41d7373a9d175471b031e7501aba Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Fri, 7 Feb 2014 00:58:48 +1100 Subject: [PATCH] Remove duplicated queries in summary page --- booking.reports.inc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/booking.reports.inc b/booking.reports.inc index fc19275..7a5d8c3 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -65,6 +65,7 @@ function booking_report_summary() { //non australian states $state_rows[] = array('International', $non_australia_count); + /* //general stats $query = db_select('booking_person', 'p') ->fields('p', array('booking_baptised', 'booking_married', 'booking_gender', 'booking_dob')) @@ -93,6 +94,7 @@ function booking_report_summary() { if ($person->booking_married == 'Y') $married_count++; } + */ //bookings by ecclesia $query = db_select('booking_person', 'p') @@ -151,6 +153,27 @@ function booking_report_summary() { //watchdog('booking', "Fully paid married person, ID !id (!first !last)", array('!id' => $person->nid,'!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname))); $fullypaid_count++; } + + //general stats + $dob_total += $person->booking_dob; + $person_count++; + + if ($person->booking_gender == 'M') + { + $male_count++; + $male_dob_total += $person->booking_dob; + } + else + { + $female_count++; + $female_dob_total += $person->booking_dob; + } + + if ($person->booking_baptised == 'Y') + $baptised_count++; + + if ($person->booking_married == 'Y') + $married_count++; } //output everything