mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 01:18:37 +00:00
formatting
This commit is contained in:
parent
6ed4590e0f
commit
a31190422a
1 changed files with 12 additions and 6 deletions
|
|
@ -440,25 +440,31 @@ class StatsResources extends Action
|
|||
usort($this->documents, function ($a, $b) {
|
||||
// Metric DESC
|
||||
$cmp = strcmp($b['metric'], $a['metric']);
|
||||
if ($cmp !== 0) return $cmp;
|
||||
if ($cmp !== 0) {
|
||||
return $cmp;
|
||||
}
|
||||
|
||||
// Period ASC
|
||||
$cmp = strcmp($a['period'], $b['period']);
|
||||
if ($cmp !== 0) return $cmp;
|
||||
if ($cmp !== 0) {
|
||||
return $cmp;
|
||||
}
|
||||
|
||||
// Time ASC, NULLs first
|
||||
if ($a['time'] === null) return ($b['time'] === null) ? 0 : -1;
|
||||
if ($b['time'] === null) return 1;
|
||||
if ($a['time'] === null) {
|
||||
return ($b['time'] === null) ? 0 : -1;
|
||||
}
|
||||
if ($b['time'] === null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return strcmp($a['time'], $b['time']);
|
||||
});
|
||||
|
||||
var_dump($this->documents);
|
||||
try {
|
||||
$dbForLogs->createOrUpdateDocuments(
|
||||
'stats',
|
||||
$this->documents,
|
||||
10 // See if this make an effect
|
||||
);
|
||||
|
||||
Console::success($message . ' | Documents: ' . count($this->documents));
|
||||
|
|
|
|||
Loading…
Reference in a new issue