Skip to content

Commit

Permalink
Merge branch 'fix/pigeon' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
arthaud-proust committed Oct 26, 2023
2 parents d914002 + ae72029 commit 55474ad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Pigeon/PigeonGetNewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __invoke(
{
$userLat = $request->input('lat');
$userLng = $request->input('lng');

$kmDistance = $distanceComputer
->from($userLat, $userLng)
->to($news->lat, $news->lng)
Expand All @@ -30,7 +30,7 @@ public function __invoke(
->getDurationInMinutes();

$request->user()->pigeon->news()->attach($news, [
'arrival_date' => now()->addMinutes($timeInMinutes),
'arrival_date' => config('pigeon.demo_flight_seconds') ? now()->addSeconds(config('pigeon.demo_flight_seconds')) : now()->addMinutes($timeInMinutes),
]);

return redirect()->route('news.index');
Expand Down
2 changes: 1 addition & 1 deletion config/pigeon.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'flight_minutes' => (int) env('PIGEON_FLIGHT_MINUTES', 10),
'demo_flight_seconds' => env('PIGEON_DEMO_FLIGHT_SECONDS'),
];
4 changes: 3 additions & 1 deletion resources/js/Components/Pigeon/PigeonPerch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ onUnmounted(() => {
})
const timeLeft = computed(() => {
return DateTime.fromISO("2017-05-15T00:00:00").plus({second: secondsLeft.value}).toLocaleString(DateTime.TIME_24_WITH_SECONDS);
return DateTime.fromISO("2017-05-15T00:00:00")
.plus({second: secondsLeft.value > 0 ? secondsLeft.value : 0})
.toLocaleString(DateTime.TIME_24_WITH_SECONDS);
})
</script>
Expand Down
3 changes: 2 additions & 1 deletion resources/js/Pages/News/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const parentElementSize = useElementSize(parentElement);
let newsStatePollingInterval: number;
onMounted(() => {
newsStatePollingInterval = setInterval(() => router.reload({only: ['news', 'pigeon']}), 10_000);
// dirty but poc
newsStatePollingInterval = setInterval(() => router.reload({only: ['news', 'pigeon']}), 1_000);
})
onUnmounted(() => {
Expand Down

0 comments on commit 55474ad

Please sign in to comment.