Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Nov 28, 2021
2 parents e8211bd + e61f349 commit 6146538
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion app/Http/Controllers/FrontendStatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ public function statusesByEvent(string $event): Renderable {
public function getStatus($statusId): Renderable {
$statusResponse = StatusBackend::getStatus($statusId);

//TODO: This is a temporary workaround. We should use standarised GeoJSON Format for this (see PR#629)
if ($statusResponse->trainCheckin->HafasTrip->polyline) {
$polyline = $statusResponse->trainCheckin->getMapLines();
foreach ($polyline as $element => $elementValue) {
$polyline[$element] = [
$elementValue[1], $elementValue[0]
];
}
}

return view('status', [
'status' => $statusResponse,
'time' => time(),
Expand All @@ -159,7 +169,8 @@ public function getStatus($statusId): Renderable {
'destination' => $statusResponse->trainCheckin->Destination->name,
'origin' => $statusResponse->trainCheckin->Origin->name
]),
'image' => route('account.showProfilePicture', ['username' => $statusResponse->user->username])
'image' => route('account.showProfilePicture', ['username' => $statusResponse->user->username]),
'polyline' => isset($polyline) ? json_encode($polyline, JSON_THROW_ON_ERROR) : null,
]);
}

Expand Down
6 changes: 3 additions & 3 deletions resources/views/includes/status.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
data-trwl-business-id="{{ $status->business }}" data-trwl-visibility="{{ $status->visibility }}"
>
@if (Route::current()->uri == "status/{id}")
@if($status->trainCheckin->HafasTrip->polyline)
@isset($polyline)
<div class="card-img-top">
<div id="map-{{ $status->id }}" class="map statusMap embed-responsive embed-responsive-16by9"
data-polygon="{{ json_encode($status->trainCheckin->getMapLines()) }}"></div>
data-polygon="{{ $polyline }}"></div>
</div>
@endif
@endisset
@endif

<div class="card-body row">
Expand Down

0 comments on commit 6146538

Please sign in to comment.