1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Fix calendar part 2

Summary: D8341 was a good start. However, I was looping through all the statuses each time, when I should only deal with a given status once. Instead, unset() a status from the list of statuses once we handled it. Also, delete the last old $key thing, which interfered with my chosen strategy.

Test Plan: made a two day event and verified it showed up in just those two days. (will push and test again just in case but this should be it)

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D8342
This commit is contained in:
Bob Trahan 2014-02-25 14:20:59 -08:00
parent b1e44239ba
commit 9b0f906207

View file

@ -167,9 +167,11 @@ final class PhabricatorPeopleProfileController
$epoch_end = $next_day->format('U'); $epoch_end = $next_day->format('U');
foreach ($statuses as $status) { foreach ($statuses as $status) {
if ($status->getDateTo() < $epoch_start) {
continue;
}
if ($status->getDateFrom() >= $epoch_end) { if ($status->getDateFrom() >= $epoch_end) {
// This list is sorted, so we can stop looking. continue;
break;
} }
$event = new AphrontCalendarEventView(); $event = new AphrontCalendarEventView();
@ -180,19 +182,7 @@ final class PhabricatorPeopleProfileController
$event->setName($status_text); $event->setName($status_text);
$event->setDescription($status->getDescription()); $event->setDescription($status->getDescription());
$event->setEventID($status->getID()); $event->setEventID($status->getID());
$key = date('Y-m-d', $event->getEpochStart());
$events[$epoch_start][] = $event; $events[$epoch_start][] = $event;
// check if this is a multi day event...!
$day_iterator = clone $day;
while (true) {
$day_iterator->modify('+ 1 day');
$day_iterator_end = $day_iterator->format('U');
if ($event->getEpochEnd() > $day_iterator_end) {
$events[$day_iterator_end][] = $event;
} else {
break;
}
}
} }
} }