Cleanup visible flight logic (#1000)
* Cleanup visible flight logic * Add transfer_time to API response
This commit is contained in:
@@ -49,15 +49,10 @@ class SetActiveFlights extends Listener
|
|||||||
// and move onto the next one
|
// and move onto the next one
|
||||||
if ($flight->start_date === null || $flight->end_date === null) {
|
if ($flight->start_date === null || $flight->end_date === null) {
|
||||||
if ($flight->days !== null && $flight->days > 0) {
|
if ($flight->days !== null && $flight->days > 0) {
|
||||||
$visible = Days::isToday($flight->days);
|
$flight->visible = Days::isToday($flight->days);
|
||||||
if ($flight->visible !== $visible) {
|
if (!$flight->visible) {
|
||||||
Log::info('Flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden'));
|
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||||
|
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||||
$flight->visible = $visible;
|
|
||||||
if ($visible === false) {
|
|
||||||
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
|
||||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,16 +66,10 @@ class SetActiveFlights extends Listener
|
|||||||
// and then make sure if days of the week are specified, check that too
|
// and then make sure if days of the week are specified, check that too
|
||||||
if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
|
if ($today->gte($flight->start_date) && $today->lte($flight->end_date)) {
|
||||||
if ($flight->days !== null && $flight->days > 0) {
|
if ($flight->days !== null && $flight->days > 0) {
|
||||||
$visible = Days::isToday($flight->days);
|
$flight->visible = Days::isToday($flight->days);
|
||||||
if ($flight->visible !== $visible) {
|
if (!$flight->visible) {
|
||||||
Log::info('Toggling flight '.$flight->ident.' to '.($visible ? 'shown' : 'hidden').'');
|
Log::info('Today='.date('N').', start=no, mask='.$flight->days.', in='
|
||||||
|
|
||||||
$flight->visible = $visible;
|
|
||||||
if ($visible === false) {
|
|
||||||
Log::info('Today='.date('N').', start='.$flight->start_date
|
|
||||||
.', end='.$flight->end_date.', mask='.$flight->days.', in='
|
|
||||||
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
.Days::in($flight->days, Days::$isoDayMap[(int) date('N')]));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class User extends Resource
|
|||||||
'last_pirep_id' => $this->last_pirep_id,
|
'last_pirep_id' => $this->last_pirep_id,
|
||||||
'flights' => $this->flights,
|
'flights' => $this->flights,
|
||||||
'flight_time' => $this->flight_time,
|
'flight_time' => $this->flight_time,
|
||||||
|
'transfer_time' => $this->transfer_time,
|
||||||
'timezone' => $this->timezone,
|
'timezone' => $this->timezone,
|
||||||
'state' => $this->state,
|
'state' => $this->state,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user