Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Commit

Permalink
Fix daily display for spanning reservations
Browse files Browse the repository at this point in the history
  • Loading branch information
lesliechae committed Aug 17, 2015
1 parent 4c763bd commit c880cbd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 31 deletions.
20 changes: 0 additions & 20 deletions ajax_actions/ajax_schedule_reservations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions calendar_util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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 .= '<td class="calendar-time" style="background:#800080" title="' . $user->fname . " " . $user->lname . '"></td>';


} else {
$rows .= '<td class="calendar-time"
style="background: -webkit-linear-gradient(left, #FFFFFF ' . $start_cell_perc . '%, #800080 ' . $ender . '%);
Expand Down
2 changes: 2 additions & 0 deletions foot.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
echo '<li><p>Example Reference Link: <ul><li>Valid: http://www.google.com. </li><li>Invalid: www.google.com</li></ul></p></li>';
echo '<li><p>For reservation restrictions, either choose from the default times or input your own in the box. All restrictions must be in minute form.</p></li>';
}

echo '<li><p>Reference links provide more information about a group, subgroup, or item.</p></li>';
echo '<li><p>Reservation restrictions tell a user the minimum and maximum time that an item can be reserved for, on what minutes of the hour the reservation can start on, and the intervals for which it can be reserved.</p></li>';
echo '<li><p>To reserve an item, click "Reserve Equipment." Choose at least one item to reserve, specify your date, time, duration, and any repeats, and then press submit.</p></li>';
echo '<li><p>Schedule conflicts or failure to follow the reservation restrictions will result in a reservation error.</p></li>';
Expand Down
3 changes: 1 addition & 2 deletions tests/web_page_tests/SchedulesCreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit c880cbd

Please sign in to comment.