mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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:
parent
b1e44239ba
commit
9b0f906207
1 changed files with 4 additions and 14 deletions
|
@ -167,9 +167,11 @@ final class PhabricatorPeopleProfileController
|
|||
$epoch_end = $next_day->format('U');
|
||||
|
||||
foreach ($statuses as $status) {
|
||||
if ($status->getDateTo() < $epoch_start) {
|
||||
continue;
|
||||
}
|
||||
if ($status->getDateFrom() >= $epoch_end) {
|
||||
// This list is sorted, so we can stop looking.
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
$event = new AphrontCalendarEventView();
|
||||
|
@ -180,19 +182,7 @@ final class PhabricatorPeopleProfileController
|
|||
$event->setName($status_text);
|
||||
$event->setDescription($status->getDescription());
|
||||
$event->setEventID($status->getID());
|
||||
$key = date('Y-m-d', $event->getEpochStart());
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue