Always pass program in onAir

This commit is contained in:
2020-01-25 01:19:37 +01:00
parent d79eccd598
commit 89e7484aa2

View File

@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -261,21 +260,22 @@ QUERY;
$einde = new \DateTimeImmutable('now + 1 second'); $einde = new \DateTimeImmutable('now + 1 second');
$schema = $this->createSchedule($start, $einde); $schema = $this->createSchedule($start, $einde);
$program = $schema['schedule'][0]['program']; $program = $schema['schedule'][0]['program'];
if($program->nonstop) {
if($program->nonstop) {
$current = $this->getTrack(); $current = $this->getTrack();
$next = $this->getTrack(/* next: */ true); $next = $this->getTrack(/* next: */ true);
$current->ends($next->start); $current->ends($next->start);
if($current->isLayout() /* || $current->secondsRemaining() < 0 */) { if($current->isLayout() /* || $current->secondsRemaining() < 0 */) {
if($next->isLayout()) { if($next->isLayout()) {
return response()->json(['inProgram' => true, 'current' => $program->name]); return response()->json(['inProgram' => true, 'program' => $program]);
} }
$current = $next; $current = $next;
} }
return response()->json(['inProgram' => false, 'current' => $current]); return response()->json(['inProgram' => false, 'current' => $current, 'program' => $program]);
} else { } else {
return response()->json(['inProgram' => true, 'current' => $program->name]); return response()->json(['inProgram' => true, 'program' => $program]);
} }
} }