From d0e5d370eb87b5a1dfbe91f883287c79d5b648b0 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 22 Jun 2016 18:01:36 +1000 Subject: [PATCH] change group fudge factor --- booking.studygroups.inc | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/booking.studygroups.inc b/booking.studygroups.inc index ebda724..9584888 100644 --- a/booking.studygroups.inc +++ b/booking.studygroups.inc @@ -763,32 +763,16 @@ function booking_studygroups_calculate() { $i = 1; //iterate over the attendee list - while ( $it->valid() ) - { - /* - //go to the first unprocessed attendee - while ($it->current()->processed == 1) - { - drupal_set_message(t('Person with id !id has already been processed earlier.', array('!id' => $it->key()))); - $it->next(); - //double check we didn't run out of people right here - if (! $it->valid() ) - { - drupal_set_message("Ran out of attendees to process."); - break; - } - } - */ + while ($it->valid()) { //cycle the session counter if we already reached the end if ($i > $group->booking_num_group_sessions) $i = 1; //get the current attendee element - $current = $it->current(); + $current = $it->current(); //assign this attendee to this session if unprocessed so far - if ($current->processed == 0) - { + if ($current->processed == 0) { //generate stats about this attendee $gender = $current->booking_gender == 'M' ? 'male' : 'female'; $age = _booking_get_age_years($current->booking_dob); @@ -993,17 +977,15 @@ function booking_studygroups_update_form($node, &$form_state, $sid) { //calculate the ratios of males to females, and various age groups $statistics = _booking_generate_statistics($attendees); - if ($statistics['males'] == 0 || $statistics['females'] == 0 || $max_people == 0) - { + if ($statistics['males'] == 0 || $statistics['females'] == 0 || $max_people == 0) { $gender_ratio = 1; } - else - { + else { $gender_ratio = ($statistics['males'] / $statistics['females']) * ($max_people / 2); } //really stretch the tolerances for placement by setting this to zero - $fudge_factor = 0; + $fudge_factor = 1; //store our final maximums as an array for easy access later $maximums = array( 'male' => ceil($gender_ratio),