Remove duplicated queries in summary page

This commit is contained in:
2014-02-07 00:58:48 +11:00
parent 9152b53390
commit 963bebdd41

View File

@@ -65,6 +65,7 @@ function booking_report_summary() {
//non australian states //non australian states
$state_rows[] = array('International', $non_australia_count); $state_rows[] = array('International', $non_australia_count);
/*
//general stats //general stats
$query = db_select('booking_person', 'p') $query = db_select('booking_person', 'p')
->fields('p', array('booking_baptised', 'booking_married', 'booking_gender', 'booking_dob')) ->fields('p', array('booking_baptised', 'booking_married', 'booking_gender', 'booking_dob'))
@@ -93,6 +94,7 @@ function booking_report_summary() {
if ($person->booking_married == 'Y') if ($person->booking_married == 'Y')
$married_count++; $married_count++;
} }
*/
//bookings by ecclesia //bookings by ecclesia
$query = db_select('booking_person', 'p') $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))); //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++; $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 //output everything