Extra stats on booking summary page

This commit is contained in:
2014-02-07 00:56:51 +11:00
parent 5726691168
commit 9152b53390
3 changed files with 40 additions and 21 deletions

View File

@@ -223,9 +223,14 @@ function shuffle_assoc($list) {
*/
function booking_studygroups_calculate() {
global $event;
$attendees = array();
$working_list = array();
//master attendee list
$attendees = array();
//temporary working copy of attendee list
$working_list = array();
//create an array to keep track of the number of people in each session for each group
$session_count = array();
//delete from booking_studygroup_mapping;
//alter table booking_studygroup_mapping AUTO_INCREMENT=1;
@@ -240,17 +245,12 @@ function booking_studygroups_calculate() {
$limit = variable_get('booking_regn_limit','500');
//add an extra one to the maximum size, to cater for some larger groups when the number of people doesn't divide evenly
$max_people = (int) ($limit / $firstgroup->booking_num_group_sessions) + 1;
//drupal_set_message(t('Fitting !num people in each group.', array('!num' => $max_people)));
//select all the attendees booked in
$query = db_query("SELECT p.nid, p.booking_partner_id, p.booking_event_id, p.booking_status, l.booking_total_lead, l.booking_available_lead, l.booking_total_help, l.booking_available_help FROM {booking_person} p left outer join {booking_leadhelp_list} l on p.nid = l.booking_node_id WHERE p.booking_event_id = :eid AND p.booking_status = 1",
array(':eid' => $event->eid));
$attendees = $query->fetchAllAssoc('nid');
//create an array to keep track of the number of people in each session for this group
$session_count = array();
//select any entries already in the mapping table
$group_mapping_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
$group_mapping = $group_mapping_query->fetchAllAssoc('sid');
@@ -439,15 +439,6 @@ function booking_studygroups_calculate() {
//cycle the session counter if we already reached the end
if ($i > $group->booking_num_group_sessions)
$i = 1;
/*
//check we have attendees left
if (! $it->valid() )
{
drupal_set_message("Ran out of attendees to process.");
break;
}
*/
//check this session has room in it
$break_condition = false;