From 2e6f6836f9cea4672b42d554dd67a296fe3891fe Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Mon, 8 Feb 2021 00:38:34 +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 331c27a..602a525 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 + 2.";"; + $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 3ea80a9..13e24df 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 + 2.";"; + $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'));