Fixes WorkerStattusController for postgresql

postgres needs every column used in a group by query to be aggregated

Dominik Sander 10 lat temu
rodzic
commit
7bd4c7b39e
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      app/controllers/worker_status_controller.rb

+ 1 - 1
app/controllers/worker_status_controller.rb

@@ -8,7 +8,7 @@ class WorkerStatusController < ApplicationController
8 8
       events = events.where('id > ?', since_id)
9 9
     end
10 10
 
11
-    result = events.select('COUNT(id) AS count', 'MIN(id) AS min_id', 'MAX(id) AS max_id').first
11
+    result = events.select('COUNT(id) AS count', 'MIN(id) AS min_id', 'MAX(id) AS max_id').reorder('min(created_at)').first
12 12
     count, min_id, max_id = result.count, result.min_id, result.max_id
13 13
 
14 14
     case max_id