change group fudge factor

This commit is contained in:
2016-06-22 18:01:36 +10:00
parent 2493f7eb98
commit d0e5d370eb

View File

@@ -763,32 +763,16 @@ function booking_studygroups_calculate() {
$i = 1; $i = 1;
//iterate over the attendee list //iterate over the attendee list
while ( $it->valid() ) 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;
}
}
*/
//cycle the session counter if we already reached the end //cycle the session counter if we already reached the end
if ($i > $group->booking_num_group_sessions) if ($i > $group->booking_num_group_sessions)
$i = 1; $i = 1;
//get the current attendee element //get the current attendee element
$current = $it->current(); $current = $it->current();
//assign this attendee to this session if unprocessed so far //assign this attendee to this session if unprocessed so far
if ($current->processed == 0) if ($current->processed == 0) {
{
//generate stats about this attendee //generate stats about this attendee
$gender = $current->booking_gender == 'M' ? 'male' : 'female'; $gender = $current->booking_gender == 'M' ? 'male' : 'female';
$age = _booking_get_age_years($current->booking_dob); $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 //calculate the ratios of males to females, and various age groups
$statistics = _booking_generate_statistics($attendees); $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; $gender_ratio = 1;
} }
else else {
{
$gender_ratio = ($statistics['males'] / $statistics['females']) * ($max_people / 2); $gender_ratio = ($statistics['males'] / $statistics['females']) * ($max_people / 2);
} }
//really stretch the tolerances for placement by setting this to zero //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 //store our final maximums as an array for easy access later
$maximums = array( $maximums = array(
'male' => ceil($gender_ratio), 'male' => ceil($gender_ratio),