Fix dates

This commit is contained in:
Axel 2021-12-23 19:07:59 +01:00
parent 9f4de0dee6
commit afd273081b
3 changed files with 6 additions and 6 deletions

View file

@ -84,9 +84,9 @@ class ApiController extends Controller
// Then we get all history for the past month // Then we get all history for the past month
$history = $task $history = $task
->history() ->history()
->orderBy('created_at', 'asc') ->orderBy('created_at', 'desc')
->where('created_at', '>', $last_days->toDateString()) ->where('created_at', '>', $last_days->toDateString())
->selectRaw('date(created_at) as date, status') ->selectRaw('date(created_at) as date, created_at, status')
->get() ->get()
; ;
@ -126,7 +126,7 @@ class ApiController extends Controller
foreach ($history as $k => $h) { foreach ($history as $k => $h) {
// We only take tasks when status has changed between them // We only take tasks when status has changed between them
if ($h->status == $prev) { if (! is_null($prev) && $h->status == $prev) {
unset($history[$k]); unset($history[$k]);
} }
$prev = $h->status; $prev = $h->status;

File diff suppressed because one or more lines are too long

View file

@ -40,7 +40,7 @@
<tbody> <tbody>
<tr <tr
v-for="h in history" v-for="h in history"
v-bind:key="history.id" v-bind:key="h.id"
> >
<td>{{ moment(h.created_at).format('YYYY-MM-DD') }}</td> <td>{{ moment(h.created_at).format('YYYY-MM-DD') }}</td>
<td>{{ moment(h.created_at).format('HH:mm:ss') }}</td> <td>{{ moment(h.created_at).format('HH:mm:ss') }}</td>