New travel email
This commit is contained in:
@@ -971,9 +971,9 @@ function booking_studygroups_update() {
|
||||
$maximums = array(
|
||||
'male' => ceil($gender_ratio),
|
||||
'female' => ceil($max_people - $gender_ratio),
|
||||
'under20' => ceil(($statistics['under20'] / $limit) * ($max_people)),
|
||||
'20to25' => ceil(($statistics['20to25'] / $limit) * ($max_people)),
|
||||
'over25' => ceil(($statistics['over25'] / $limit) * ($max_people)),
|
||||
'under20' => ceil(($statistics['under20'] / $limit) * ($max_people - $fudge_factor)),
|
||||
'20to25' => ceil(($statistics['20to25'] / $limit) * ($max_people - $fudge_factor)),
|
||||
'over25' => ceil(($statistics['over25'] / $limit) * ($max_people - $fudge_factor)),
|
||||
);
|
||||
|
||||
drupal_set_message(t('Aiming for !males males, !females females in group. Made up of !20s under 20, !low20s between 20 and 25, and !high20s over 25. Total count in group is !max.',
|
||||
@@ -1058,6 +1058,7 @@ function booking_studygroups_update() {
|
||||
$spouse_id = $working_list[$person->booking_node_id]->booking_partner_id;
|
||||
$bf_gf_id = $working_list[$person->booking_node_id]->booking_bf_gf_nid;
|
||||
$gender = $working_list[$person->booking_node_id]->booking_gender == 'M' ? 'male' : 'female';
|
||||
$session_id = $person->booking_session_id;
|
||||
|
||||
//if the study group id matches the group we're currently looking at, and they have a role defined
|
||||
if ($person->booking_studygroup_id == $group->sid && $person->booking_studygroup_role > 0)
|
||||
@@ -1069,20 +1070,51 @@ function booking_studygroups_update() {
|
||||
|
||||
//mark this position as being used
|
||||
$age = _booking_get_age_years($working_list[$person->booking_node_id]->booking_dob);
|
||||
_booking_assign_attendee_group($person->booking_node_id, $person->booking_session_id, 'male', $age, $working_list, $session_count);
|
||||
_booking_assign_attendee_group($person->booking_node_id, $session_id, 'male', $age, $working_list, $session_count);
|
||||
|
||||
//make sure the leader/helper's partner gets updated now, otherwise they could still end up in different groups
|
||||
if ($spouse_id > 0)
|
||||
{
|
||||
//also mark their spouse as allocated to this group
|
||||
drupal_set_message(t('Spouse with id !id assigned to session !session (currently with !num people).',
|
||||
array('!id' => $spouse_id, '!session' => $person->booking_session_id,
|
||||
'!num' => $session_count[$person->booking_session_id]['total'])
|
||||
));
|
||||
$age = _booking_get_age_years($working_list[$spouse_id]->booking_dob);
|
||||
$spouse_gender = $working_list[$spouse_id]->booking_gender == 'M' ? 'male' : 'female';
|
||||
_booking_assign_attendee_group($spouse_id, $session_id, $spouse_gender, $age, $working_list, $session_count);
|
||||
}
|
||||
elseif ($bf_gf_id > 0)
|
||||
{
|
||||
//also mark their boyfriend/girlfriend as allocated to this group
|
||||
drupal_set_message(t('BF/GF with id !id assigned to session !session (currently with !num people).',
|
||||
array('!id' => $bf_gf_id, '!session' => $person->booking_session_id,
|
||||
'!num' => $session_count[$person->booking_session_id]['total'])
|
||||
));
|
||||
$age = _booking_get_age_years($working_list[$bf_gf_id]->booking_dob);
|
||||
$bfgf_gender = $working_list[$bf_gf_id]->booking_gender == 'M' ? 'male' : 'female';
|
||||
_booking_assign_attendee_group($bf_gf_id, $session_id, $bfgf_gender, $age, $working_list, $session_count);
|
||||
}
|
||||
|
||||
}
|
||||
//anyone else already assigned to this group previously
|
||||
elseif ($person->booking_studygroup_id == $group->sid && $working_list[$person->booking_node_id]->processed == 0)
|
||||
{
|
||||
{
|
||||
if ($spouse_id > 0)
|
||||
{
|
||||
//if the spouse has already been processed due to being a leader or helper, use that session
|
||||
if ($working_list[$spouse_id]->processed == 1)
|
||||
{
|
||||
$session_id = $working_list[$spouse_id]->session;
|
||||
}
|
||||
|
||||
//mark this person as allocated to this group
|
||||
drupal_set_message(t('Married person with id !id assigned to session !session (currently with !num people).',
|
||||
array('!id' => $person->booking_node_id, '!session' => $person->booking_session_id,
|
||||
'!num' => $session_count[$person->booking_session_id]['total'])
|
||||
));
|
||||
$age = _booking_get_age_years($working_list[$person->booking_node_id]->booking_dob);
|
||||
_booking_assign_attendee_group($person->booking_node_id, $person->booking_session_id, $gender, $age, $working_list, $session_count);
|
||||
_booking_assign_attendee_group($person->booking_node_id, $session_id, $gender, $age, $working_list, $session_count);
|
||||
|
||||
//also mark their spouse as allocated to this group
|
||||
drupal_set_message(t('Spouse with id !id assigned to session !session (currently with !num people).',
|
||||
@@ -1091,17 +1123,23 @@ function booking_studygroups_update() {
|
||||
));
|
||||
$age = _booking_get_age_years($working_list[$spouse_id]->booking_dob);
|
||||
$spouse_gender = $working_list[$spouse_id]->booking_gender == 'M' ? 'male' : 'female';
|
||||
_booking_assign_attendee_group($spouse_id, $person->booking_session_id, $spouse_gender, $age, $working_list, $session_count);
|
||||
_booking_assign_attendee_group($spouse_id, $session_id, $spouse_gender, $age, $working_list, $session_count);
|
||||
}
|
||||
elseif ($bf_gf_id > 0)
|
||||
{
|
||||
//if the bf/gf has already been processed due to being a leader or helper, use that session
|
||||
if ($working_list[$bf_gf_id]->processed == 1)
|
||||
{
|
||||
$session_id = $working_list[$bf_gf_id]->session;
|
||||
}
|
||||
|
||||
//mark this person as allocated to this group
|
||||
drupal_set_message(t('Person with id !id in relationship assigned to session !session (currently with !num people).',
|
||||
array('!id' => $person->booking_node_id, '!session' => $person->booking_session_id,
|
||||
'!num' => $session_count[$person->booking_session_id]['total'])
|
||||
));
|
||||
$age = _booking_get_age_years($working_list[$person->booking_node_id]->booking_dob);
|
||||
_booking_assign_attendee_group($person->booking_node_id, $person->booking_session_id, $gender, $age, $working_list, $session_count);
|
||||
_booking_assign_attendee_group($person->booking_node_id, $session_id, $gender, $age, $working_list, $session_count);
|
||||
|
||||
//also mark their boyfriend/girlfriend as allocated to this group
|
||||
drupal_set_message(t('BF/GF with id !id assigned to session !session (currently with !num people).',
|
||||
@@ -1110,12 +1148,12 @@ function booking_studygroups_update() {
|
||||
));
|
||||
$age = _booking_get_age_years($working_list[$bf_gf_id]->booking_dob);
|
||||
$bfgf_gender = $working_list[$bf_gf_id]->booking_gender == 'M' ? 'male' : 'female';
|
||||
_booking_assign_attendee_group($bf_gf_id, $person->booking_session_id, $bfgf_gender, $age, $working_list, $session_count);
|
||||
_booking_assign_attendee_group($bf_gf_id, $session_id, $bfgf_gender, $age, $working_list, $session_count);
|
||||
}
|
||||
//for anyone else, just record what session they're currently in
|
||||
else
|
||||
{
|
||||
$working_list[$person->booking_node_id]->session = $person->booking_session_id;
|
||||
$working_list[$person->booking_node_id]->session = $session_id;
|
||||
}
|
||||
} //end looking at people with spouse or bf/gf
|
||||
} //end searching for people to pre-allocate
|
||||
@@ -1220,9 +1258,11 @@ function booking_studygroups_update() {
|
||||
if ($mapping->booking_session_id !== $person->session)
|
||||
{
|
||||
drupal_set_message(t('Found existing study group session for user !id. Changing old session !old to !session. Role id is !role',
|
||||
array('!id' => $person->nid, '!old' => $mapping->booking_session_id, '!session' => $person->session, '!role' => $person->booking_studygroup_role)));
|
||||
array('!id' => $person->nid, '!old' => $mapping->booking_session_id, '!session' => $person->session,
|
||||
'!role' => $person->booking_studygroup_role)));
|
||||
|
||||
//update the entry
|
||||
|
||||
db_update('booking_studygroup_mapping')
|
||||
->fields(array(
|
||||
'booking_session_id' => $person->session,
|
||||
@@ -1230,7 +1270,7 @@ function booking_studygroups_update() {
|
||||
))
|
||||
->condition('sid', $mapping->sid)
|
||||
->execute();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user