FIX: Bug with admin trust level growth report (#19050)

When this report in the admin dashboard has lots of data ( > 75 days of activity), the dates were ordered incorrectly. This is apparently expected behaviour; when using GROUP BY without specifying the ordering, PG decides to order, and it so happens that it works under some conditions but not others. Explicit ordering fixes the problem. 

However, because this works in some conditions but not others, we can't really add a useful test.
This commit is contained in:
Penar Musaraj 2022-11-16 22:11:09 -05:00 committed by GitHub
parent 0ef8d0a7bc
commit 5ee3e2932f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ module Reports::TrustLevelGrowth
OR action = #{UserHistory.actions[:auto_trust_level_change]}
)
GROUP BY date(created_at)
ORDER BY date(created_at)
SQL
data = Hash[ filters.collect { |x| [x, []] } ]