program fix previous events
This commit is contained in:
parent
94cf47ee43
commit
6875193964
1 changed files with 0 additions and 28 deletions
|
|
@ -54,34 +54,6 @@ function splitNextAndPreviousEvents($events) {
|
|||
];
|
||||
}
|
||||
|
||||
function filterPastEvents($events) {
|
||||
$pastEvents = new Pages();
|
||||
|
||||
foreach ($events as $event) {
|
||||
$sessions = $event->isMapadoEvent() == 'true' ? $event->remoteSessions()->toStructure() : $event->sessions()->toStructure();
|
||||
|
||||
$sessionDates = $sessions->map(function($session) {
|
||||
return $session->date()->value();
|
||||
})->data;
|
||||
|
||||
$pastDates = array_filter($sessionDates, function ($date) {
|
||||
// strtotime() gives the timestamp for midnight
|
||||
// time() gives the current timestamp so if the event occurs today it will be considered as past after midnight
|
||||
// so we need to add a day, in seconds
|
||||
$oneDayInSecond = 24*60*60;
|
||||
$oneDayInSecond = 24*60*60;
|
||||
$dateTimeStamp = strtotime($date) - $oneDayInSecond;
|
||||
return $date < time();
|
||||
});
|
||||
|
||||
if (count($pastDates) == count($sessionDates)) {
|
||||
$pastEvents->add($event);
|
||||
}
|
||||
}
|
||||
|
||||
return $pastEvents;
|
||||
}
|
||||
|
||||
function buildFieldsString($requestFields) {
|
||||
$fields = [];
|
||||
foreach ($requestFields as $field) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue