Skip to content
Snippets Groups Projects
Commit 9506247d authored by Tibo's avatar Tibo
Browse files

use time to find last day of data...

parent c5687696
No related branches found
No related tags found
No related merge requests found
Pipeline #3747 failed
......@@ -72,17 +72,12 @@ class Server extends Model
return $this->records_1day;
}
$records = \Mongo::get()->monitoring->records->find(
["server_id" => $this->id],
["limit" => 288, "sort" => ["_id" => -1]]
)->toArray();
usort($records, function ($r1, $r2) {
return $r1->time > $r2->time ? 1 : -1;
});
$this->records_1day = $records;
$start = time() - 24 * 3600;
$records = \Mongo::get()->monitoring->records->find([
"server_id" => $this->id,
"time" => ['$gte' => $start]])
->toArray();
return $records;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment