diff --git a/booking.studygroups.inc b/booking.studygroups.inc index 3a17570..8be7cac 100644 --- a/booking.studygroups.inc +++ b/booking.studygroups.inc @@ -441,28 +441,22 @@ function booking_studygroups_calculate() { } } + //cycle the session counter if we already reached the end if ($i > $group->booking_num_group_sessions) $i = 1; - //TODO - //Change this from a for loop - //to a check to see if a counter is greater than the number of sessions - //if it is then set it back to 1 - - //iterate over the session list - //for ($i = 1; $i <= $group->booking_num_group_sessions; $i++) - //for ($i = 1; $i <= 16; $i++) - //{ + /* //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; - while ($session_count[$i] > $max_people) + while ($session_count[$i] >= $max_people) { drupal_set_message(t("Session ID !id is full, moving to next session for user id !nid", array('!id' => $i, '!nid' => $it->key()))); $i++; @@ -480,16 +474,6 @@ function booking_studygroups_calculate() { } } - /* - if ($session_count[$i] > $max_people) - { - drupal_set_message(t("Session ID !id is full, moving to next session for user id !nid", array('!id' => $i, '!nid' => $it->key()))); - //$i++; - continue; - } - */ - - //get the current attendee element $current = $it->current(); @@ -527,10 +511,7 @@ function booking_studygroups_calculate() { } //move to the next session - $i++; - - //} //finished looping through session list - + $i++; } //finished looping through attendees for this study group @@ -612,8 +593,6 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) { drupal_goto('admin/config/booking'); return ""; } - - watchdog('booking', 'Study groups id: @info', array ('@info' => var_export($group_id, TRUE))); $header = array( 'booking_session_id' => array('data' => t('Study Group Session'), 'field' => 'm.booking_session_id', 'sort' => 'asc'),