From c880cbd240f15463d34f5a4e01e16539fa57f134 Mon Sep 17 00:00:00 2001 From: lesliechae Date: Mon, 17 Aug 2015 10:40:22 -0400 Subject: [PATCH] Fix daily display for spanning reservations --- ajax_actions/ajax_schedule_reservations.php | 20 -------------------- calendar_util.php | 14 +++++--------- foot.php | 2 ++ tests/web_page_tests/SchedulesCreateTest.php | 3 +-- 4 files changed, 8 insertions(+), 31 deletions(-) diff --git a/ajax_actions/ajax_schedule_reservations.php b/ajax_actions/ajax_schedule_reservations.php index effe8fb..8195079 100755 --- a/ajax_actions/ajax_schedule_reservations.php +++ b/ajax_actions/ajax_schedule_reservations.php @@ -123,26 +123,6 @@ } - //kills all tests -// $intSchedDur = util_durToInt($strScheduleDuration); -//util_prePrintR($intSchedDur); -//util_prePrintR(($reservRestrictionMax)); -//util_prePrintR($reservRestrictionMin); -// -// # check if duration time matches reservation restrictions -// # check this with a test? -// if (!($intSchedDur >= $reservRestrictionMin && $intSchedDur <= $reservRestrictionMax)) { -// $results['note'] = 'not within reservation restrictions'; -// echo json_encode($results); -// exit; -// } -// -// # check if duration interval matches reservation restrictions -// if (!($intSchedDur % $reservRestrictionDur == 0)) { -// $results['note'] = 'does not follow duration restriction'; -// echo json_encode($results); -// exit; -// } # TODO: NOTE this is obsolete as the EqGroup::getOneFromDb above returns false if eq_group.flag_delete = true # check that eq_group is active diff --git a/calendar_util.php b/calendar_util.php index 9d1cedd..efa19f4 100755 --- a/calendar_util.php +++ b/calendar_util.php @@ -161,11 +161,12 @@ function renderItemRows($items,$headings,$scheds,$month,$day,$year) //******** to find rounded start time: //******** round the timeblock_start_time minutes to the nearest quarter hour using the formula and convert to date ## else if start time % 15 == 0 then use regular start time (not rounded) and have start percentage = 100 - if ($start_minute == 'x') { + if ($start_minute === 'x') { $sched_tb_round = '00:00:00'; $start_percent[timetoInt($sched_tb_round)] = 100; //the duration should only go until the end time block } elseif ($start_minute % 15 != 0) { + while ($start_minute > 15) { $start_minute -= 15; } @@ -192,17 +193,15 @@ function renderItemRows($items,$headings,$scheds,$month,$day,$year) } ## finds the start box based upon the start time given (rounded or unrounded) and relates it to the duration - $starts[timetoInt($sched_tb_round)] = durationToInt($duration); - + $starts[timetoInt($sched_tb_round)] = array(durationToInt($duration), $sched->reservations[0]->user); } elseif (strtotime(substr($start_tb, 0, 10)) < strtotime($year . '-' . $month . '-' . $day) && strtotime($year . '-' . $month . '-' . $day) < strtotime(substr($end_tb, 0, 10))) { $sched_tb_round = '00:00:00'; $start_percent[timetoInt($sched_tb_round)] = 100; $end_percent[timetoInt($sched_tb_round)] = 100; - ## finds the start box based upon the start time given (rounded or unrounded) and relates it to the duration - $starts[timetoInt($sched_tb_round)] = array(durationToInt($sched->timeblock_duration),$sched->reservations[0]->user); - + ## finds the start box based upon the start time given (rounded or unrounded) and relates it to the duration + $starts[timetoInt($sched_tb_round)] = array(durationToInt($sched->timeblock_duration),$sched->reservations[0]->user); } } } @@ -234,10 +233,7 @@ function renderItemRows($items,$headings,$scheds,$month,$day,$year) ## If the start percent is 100 (or the reservation starts on a quarter marker) then just fill in the box ## Else have to fill in according to the percentages if ($start_percent[$x] == 100) { - $rows .= 'lname . '">'; - - } else { $rows .= ''; echo '
  • Schedule conflicts or failure to follow the reservation restrictions will result in a reservation error.

  • '; diff --git a/tests/web_page_tests/SchedulesCreateTest.php b/tests/web_page_tests/SchedulesCreateTest.php index 7600b7f..1c77dea 100755 --- a/tests/web_page_tests/SchedulesCreateTest.php +++ b/tests/web_page_tests/SchedulesCreateTest.php @@ -103,7 +103,6 @@ function testManagerAccessForManagerSchedule() { $this->signIn(); $par = $this->getBaseUrlParamsArray(); -// util_prePrintR($this->urlbase . "?" . $this->urlParamsArrayToString($par)); $this->get($this->urlbase . "?" . $this->urlParamsArrayToString($par)); $this->assertNoPattern('/cannot create manager reservation - not a manager of this group/i'); @@ -478,7 +477,7 @@ function testFailOnCreateRepeatingSingleItemTimingConflictIsManager() { unset($par['subgroup-302-406']); unset($par['subgroup-302-412']); - $par['eqGroupID'] = '203'; // set group to one which the user has consumer access and NOT manager access + $par['eqGroupID'] = '203'; // set group to one which the user has consumer access and NOT manager access $par['subgroup-309-413'] = '413'; // add necessary array element that corresponds to subgroup and subgroup item $par['scheduleStartOnDate'] = '2013-07-01'; $par['scheduleEndOnDate'] = '2013-07-17';