mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Respect time nulls
This commit is contained in:
parent
494fe274b0
commit
b44051e0a2
1 changed files with 7 additions and 2 deletions
|
|
@ -434,7 +434,7 @@ class StatsResources extends Action
|
|||
{
|
||||
$message = 'Stats writeDocuments project: ' . $project->getId() . '(' . $project->getSequence() . ')';
|
||||
|
||||
// sort by unique index key to make
|
||||
// sort by unique index key reduce locks
|
||||
usort($this->documents, function($a, $b) {
|
||||
// metric DESC
|
||||
$cmp = strcmp($b['metric'], $a['metric']);
|
||||
|
|
@ -444,10 +444,15 @@ class StatsResources extends Action
|
|||
$cmp = strcmp($a['period'], $b['period']);
|
||||
if ($cmp !== 0) return $cmp;
|
||||
|
||||
// time ASC (string comparison is fine)
|
||||
// time ASC, NULLs first
|
||||
if ($a['time'] === null && $b['time'] === null) return 0;
|
||||
if ($a['time'] === null) return -1;
|
||||
if ($b['time'] === null) return 1;
|
||||
|
||||
return strcmp($a['time'], $b['time']);
|
||||
});
|
||||
|
||||
var_dump($this->documents);
|
||||
try {
|
||||
$dbForLogs->createOrUpdateDocuments(
|
||||
'stats',
|
||||
|
|
|
|||
Loading…
Reference in a new issue