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