Compare commits
No commits in common. "c55d572ec4ff039a9e678b732536a89e25afcd7f" and "802c9398d5ac6db8709db4d1708b275063a9a5a6" have entirely different histories.
c55d572ec4
...
802c9398d5
3 changed files with 6 additions and 53 deletions
|
@ -29,7 +29,10 @@ class Kernel extends ConsoleKernel
|
||||||
});
|
});
|
||||||
|
|
||||||
$schedule->command('digest:send --fortnightly')
|
$schedule->command('digest:send --fortnightly')
|
||||||
->twiceMonthly(1,16,'13:00')
|
->weeklyOn(5, '00:01')
|
||||||
|
->when(function () {
|
||||||
|
return (time() / 604800 % 2);
|
||||||
|
})
|
||||||
->onFailure(function () {
|
->onFailure(function () {
|
||||||
Log::error("Fortnightly email digest send failed");
|
Log::error("Fortnightly email digest send failed");
|
||||||
});
|
});
|
||||||
|
|
|
@ -141,7 +141,7 @@ class TrackerController extends Controller
|
||||||
|
|
||||||
$client = new Client([
|
$client = new Client([
|
||||||
'base_uri' => 'https://app.wayward.travel/',
|
'base_uri' => 'https://app.wayward.travel/',
|
||||||
'timeout' => 20.0
|
'timeout' => 10.0
|
||||||
]);
|
]);
|
||||||
$response = $client->get('trip/'.($tripId ?? config('app.current_trip_id')).'/user/zmld8ko6qy7d9j3xvq10/json');
|
$response = $client->get('trip/'.($tripId ?? config('app.current_trip_id')).'/user/zmld8ko6qy7d9j3xvq10/json');
|
||||||
|
|
||||||
|
@ -173,60 +173,10 @@ class TrackerController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data->trip->locations = $this->decode_polyline($data->trip->route);
|
|
||||||
|
|
||||||
return $data->trip;
|
return $data->trip;
|
||||||
default:
|
default:
|
||||||
// TODO: Add proper error handling.
|
// TODO: Add proper error handling.
|
||||||
return "Something went wrong";
|
return "Something went wrong";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Decode route polyline.
|
|
||||||
*
|
|
||||||
* Source: https://github.com/dyaaj/polyline-encoder
|
|
||||||
*
|
|
||||||
* @param object $value
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
public function decode_polyline($value)
|
|
||||||
{
|
|
||||||
$index = 0;
|
|
||||||
$points = array();
|
|
||||||
$lat = 0;
|
|
||||||
$lng = 0;
|
|
||||||
$id = 0;
|
|
||||||
|
|
||||||
while ($index < strlen($value)) {
|
|
||||||
$b;
|
|
||||||
$shift = 0;
|
|
||||||
$result = 0;
|
|
||||||
do {
|
|
||||||
$b = ord(substr($value, $index++, 1)) - 63;
|
|
||||||
$result |= ($b & 0x1f) << $shift;
|
|
||||||
$shift += 5;
|
|
||||||
} while ($b > 31);
|
|
||||||
$dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1));
|
|
||||||
$lat += $dlat;
|
|
||||||
|
|
||||||
$shift = 0;
|
|
||||||
$result = 0;
|
|
||||||
do {
|
|
||||||
$b = ord(substr($value, $index++, 1)) - 63;
|
|
||||||
$result |= ($b & 0x1f) << $shift;
|
|
||||||
$shift += 5;
|
|
||||||
} while ($b > 31);
|
|
||||||
$dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1));
|
|
||||||
$lng += $dlng;
|
|
||||||
|
|
||||||
array_push($points, (object)[
|
|
||||||
'id' => $id++,
|
|
||||||
'latitude' => $lat/100000,
|
|
||||||
'longitude'=> $lng/100000
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $points;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
var routePoints = L.polyline([
|
var routePoints = L.polyline([
|
||||||
@foreach($trip->locations as $location)
|
@foreach($trip->locations as $location)
|
||||||
@if(!in_array($location->id, config('app.current_trip_ignore')))
|
@if(!in_array($location->id, config('app.current_trip_ignore')))
|
||||||
[{{ $location->latitude }}, {{ $location->longitude }}], // {{$location->id}}
|
[{{ $location->latitude }}, {{ $location->longitude }}],
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
], {
|
], {
|
||||||
|
|
Loading…
Reference in a new issue