From 6da0c8a83576b381bd39b79e5db3527bd69a2c54 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 7 Apr 2023 23:48:07 +0200 Subject: [PATCH] Fixed public dashboard stats and sorting --- includes/model/Shifts_model.php | 1 + includes/model/Stats.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 3925460a..0e9022ff 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -85,6 +85,7 @@ function Shifts_free($start, $end, ShiftsFilter $filter = null) return Shift::query() ->whereIn('id', $shifts->pluck('id')->toArray()) + ->orderBy('shifts.start') ->get(); } diff --git a/includes/model/Stats.php b/includes/model/Stats.php index adc4af32..afd5cb60 100644 --- a/includes/model/Stats.php +++ b/includes/model/Stats.php @@ -1,6 +1,7 @@ addHours(3)->toDateTimeString(); $result = Db::selectOne(' SELECT SUM(`count`) AS `count` FROM ( SELECT @@ -157,6 +158,8 @@ function stats_angels_needed_for_nightshifts(ShiftsFilter $filter = null) date('Y-m-d', time() + 12 * 60 * 60) . ' ' . $nightStartTime . ':00' ); $night_end = $night_start + ($nightEndTime - $nightStartTime) * 60 * 60; + $night_start = Carbon::createFromTimestamp($night_start)->toDateTimeString(); + $night_end = Carbon::createFromTimestamp($night_end)->toDateTimeString(); $result = Db::selectOne(' SELECT SUM(`count`) AS `count` FROM ( SELECT