From d8c92ae0c71a548bb3d6fa9fc8b6ba518f6b36e1 Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Mon, 8 Feb 2021 00:38:05 +0100 Subject: [PATCH] Stuff --- app/Models/Storage.php | 2 +- app/Models/Traffic.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Storage.php b/app/Models/Storage.php index 74c1757..331c27a 100644 --- a/app/Models/Storage.php +++ b/app/Models/Storage.php @@ -41,7 +41,7 @@ class Storage extends Authenticatable ]; public static function getLastDays(int $days = 7) { - $sql = "SELECT `date`, `tenant`, (sum(size)/24) AS size FROM `storage` WHERE `tenant` = ".session("current_tenant_id")." GROUP BY `date`, `tenant` ORDER BY `date` DESC LIMIT ".$days.";"; + $sql = "SELECT `date`, `tenant`, (sum(size)/24) AS size FROM `storage` WHERE `tenant` = ".session("current_tenant_id")." GROUP BY `date`, `tenant` ORDER BY `date` DESC LIMIT ".$days + 2.";"; $res = DB::select($sql); $now = new \DateTime( $days." days ago", new \DateTimeZone('UTC')); diff --git a/app/Models/Traffic.php b/app/Models/Traffic.php index e721d83..3ea80a9 100644 --- a/app/Models/Traffic.php +++ b/app/Models/Traffic.php @@ -47,7 +47,7 @@ class Traffic extends Authenticatable ]; public static function getLastDays(int $days = 7) { - $sql = "SELECT year, month, day, typ, SUM(traffic) AS `traffic` FROM traffic WHERE tenant = ".session("current_tenant_id")." GROUP BY year, month, day, typ ORDER BY year DESC, month DESC, day DESC LIMIT ".$days.";"; + $sql = "SELECT year, month, day, typ, SUM(traffic) AS `traffic` FROM traffic WHERE tenant = ".session("current_tenant_id")." GROUP BY year, month, day, typ ORDER BY year DESC, month DESC, day DESC LIMIT ".$days + 2.";"; $res = DB::select($sql); $now = new \DateTime( $days." days ago", new \DateTimeZone('UTC'));