bug fixes

This commit is contained in:
2014-06-17 10:53:21 +10:00
parent c8d7429092
commit 6a05848fee
2 changed files with 38 additions and 35 deletions

View File

@@ -753,7 +753,7 @@ function booking_rooms_allocate_form($node, &$form_state, $location_id) {
$married = $row->booking_partner_id > 0 ? ' *' : '';
$age = _booking_get_age_years($row->booking_dob);
$assigned_flag = empty($room_mapping[$row->nid]) ? '' : ' - ';
$attendee_select[$row->nid] = $assigned_flag . $row->booking_firstname . ' ' . $row->booking_lastname . ' ['. $age . ' ' . $row->booking_gender . ']' . $married;
$attendee_select[$row->nid] = $assigned_flag . $row->booking_lastname . ', ' . $row->booking_firstname . ' ' . ' ['. $age . ' ' . $row->booking_gender . ']' . $married;
}

View File

@@ -562,9 +562,9 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
db_update('booking_studygroup_mapping')
->fields(array(
'booking_session_id' => $value,
'booking_is_leader' => $person_groups[$key]->booking_is_leader,
'booking_is_helper' => $person_groups[$key]->booking_is_helper,
'booking_is_reserveleader' => $person_groups[$key]->booking_is_reserveleader,
//'booking_is_leader' => $person_groups[$key]->booking_is_leader,
//'booking_is_helper' => $person_groups[$key]->booking_is_helper,
//'booking_is_reserveleader' => $person_groups[$key]->booking_is_reserveleader,
'booking_studygroup_role' => $person_groups[$key]->booking_studygroup_role,
))
->condition('sid', $person_groups[$key]->sid)
@@ -587,9 +587,9 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
'booking_node_id' => $nid,
'booking_studygroup_id' => $key,
'booking_session_id' => $value,
'booking_is_leader' => 'N',
'booking_is_helper' => 'N',
'booking_is_reserveleader' => 'N',
//'booking_is_leader' => 'N',
//'booking_is_helper' => 'N',
//'booking_is_reserveleader' => 'N',
'booking_studygroup_role' => 0,
))
->execute();
@@ -862,8 +862,7 @@ function booking_studygroups_calculate() {
//iterate over the attendee list and write to the database the session they're assigned to
//use the multi-insert query type at https://drupal.org/node/310079
$insert_query = db_insert('booking_studygroup_mapping')->fields(array('booking_eventid', 'booking_node_id',
'booking_studygroup_id', 'booking_session_id', 'booking_is_leader', 'booking_is_helper',
'booking_is_reserveleader', 'booking_studygroup_role'));
'booking_studygroup_id', 'booking_session_id', 'booking_studygroup_role'));
foreach($working_list as $person)
{
@@ -910,9 +909,9 @@ function booking_studygroups_calculate() {
'booking_node_id' => $person->nid,
'booking_studygroup_id' => $group->sid,
'booking_session_id' => $person->session,
'booking_is_leader' => $person->is_leader,
'booking_is_helper' => $person->is_helper,
'booking_is_reserveleader' => $person->is_reserveleader,
//'booking_is_leader' => $person->is_leader,
//'booking_is_helper' => $person->is_helper,
//'booking_is_reserveleader' => $person->is_reserveleader,
'booking_studygroup_role' => $person->booking_studygroup_role,
);
$insert_query->values($record);
@@ -972,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 - $fudge_factor)),
'20to25' => ceil(($statistics['20to25'] / $limit) * ($max_people - $fudge_factor)),
'over25' => ceil(($statistics['over25'] / $limit) * ($max_people - $fudge_factor)),
'under20' => ceil(($statistics['under20'] / $limit) * ($max_people)),
'20to25' => ceil(($statistics['20to25'] / $limit) * ($max_people)),
'over25' => ceil(($statistics['over25'] / $limit) * ($max_people)),
);
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.',
@@ -1466,35 +1465,39 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) {
//retrieve which sort is active in the current view
$sort = tablesort_get_order($header);
$last_session = 0;
foreach($result as $data)
{
//apply theme as required
$class = $class_array[$data->booking_studygroup_role];
/*
//apply theme as required
if ($data->booking_is_leader == 'Y')
$class = "leader-row";
elseif ($data->booking_is_helper == 'Y')
$class = "helper-row";
elseif ($data->booking_is_reserveleader == 'Y')
$class = "helper-row";
else
$class = "normal-row";
*/
//only add the lines separating groups if we're sorting by the session id
if ($sort['sql'] == "m.booking_session_id")
{
//Add a different id for first entry of new session, with a border-top to distinguish it
if ($last_session <> $data->booking_session_id && $last_session <> "")
/*
if ($data->nid == "924")
{
if ($class === "leader-row")
$class = "leader-new-group-row";
elseif ($class === "helper-row")
$class = "helper-new-group-row";
watchdog('booking', 'Reading group test. Last session: !last. This session: !curr. Class: !class',
array ('!last' => $last_session, '!curr' => $data->booking_session_id, '!class' => $class));
}
*/
//Add a different id for first entry of new session, with a border-top to distinguish it
if ($last_session <> $data->booking_session_id)
{
if ($data->booking_studygroup_role == 1)
{
$class = "leader-new-group-row";
}
elseif ($data->booking_studygroup_role == 2 || $data->booking_studygroup_role == 3)
{
$class = "helper-new-group-row";
}
else
$class = "new-group-row";
{
$class = "new-group-row";
}
}
}