Problem/Motivation

The unaggregated results are not ordered, the ordering was not committed as expected. Issue #2401119: Database aggregator: Verbose extra fields

Proposed resolution

Order the unaggregated results.

Remaining tasks

All of it.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

LKS90’s picture

I'm not sure, but I think this code was related with doing exactly that:

- // Order by most recent or id.
+    // Order by most recent through time interval field.
     if ($this->getTimeIntervalField()) {
       $query->sort($this->getTimeIntervalField(), 'DESC');
     }
-    else {
-      $query->sort($entity_info->getKey('id'), 'DESC');
-    }
+    // Always order by primary key to solve the second granularity issue.
+    $query->sort($entity_info->getKey('id'), 'DESC');
LKS90’s picture

Status: Active » Needs review
StatusFileSize
new597 bytes

Here is the patch, it basically just adds the if statement from the first comment to order the results by timestamp configured in the settings. Ordering by id isn't possible with databases, there are various IDs and no way to get a primary key as a fallback.

Status: Needs review » Needs work

The last submitted patch, 2: ordering_unaggregated-2532874-2.patch, failed testing.

LKS90’s picture

Status: Needs work » Needs review
StatusFileSize
new1.83 KB
new2.42 KB

Tests are fixed! There are more results for the successful login sensor now that the other tests have been uncommented.

LKS90’s picture

StatusFileSize
new2.42 KB

Rebased, if it really was necessary.

Edit: Looks the same, was unnecessary :D.

Status: Needs review » Needs work

The last submitted patch, 5: ordering_unaggregated-2532874-5.patch, failed testing.

Status: Needs work » Needs review

  • Berdir committed 3b88160 on 8.x-1.x authored by LKS90
    Issue #2532874 by LKS90: Ordering unaggregated results is not done...
berdir’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.