FIX: Properly capture period for /filter emotion ordering (#940)

This commit is contained in:
Rafael dos Santos Silva 2024-11-21 16:54:30 -03:00 committed by GitHub
parent 8e00e036e1
commit 2c78961bed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

@ -17,8 +17,7 @@ module DiscourseAi
end
&.expr
&.split(">=")
&.last if scope.arel.constraints.present? &&
scope.arel.constraints.any? { |c| c.is_a?(Arel::Nodes::Grouping) }
&.last if scope.to_sql.include?("topics.bumped_at >=")
# Fallback in case we can't find the scope period
scope_period ||= "CURRENT_DATE - INTERVAL '1 year'"