This commit is contained in:
Kekskurse 2021-02-08 00:38:34 +01:00
parent d8c92ae0c7
commit 2e6f6836f9
2 changed files with 2 additions and 2 deletions

View file

@ -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'));

View file

@ -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'));