@@ -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 |