Skip to content

Commit

Permalink
FIX: Adding DATE casts to the Reaction dashboard report (#235)
Browse files Browse the repository at this point in the history
The Reactions dashboard report did not include data from the day of the end_date. Casting the created_at values as DATE should now include this.
  • Loading branch information
JimmyJammyDodger committed Sep 4, 2023
1 parent d0c0f40 commit 3411bdd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin.rb
Expand Up @@ -200,7 +200,7 @@ class Engine < ::Rails::Engine
FROM discourse_reactions_reactions as drr
LEFT OUTER JOIN discourse_reactions_reaction_users as drru on drr.id = drru.reaction_id
WHERE drr.reaction_users_count IS NOT NULL
AND drru.created_at >= :start_date::DATE AND drru.created_at <= :end_date::DATE
AND drru.created_at::DATE >= :start_date::DATE AND drru.created_at::DATE <= :end_date::DATE
GROUP BY drr.reaction_value, day
SQL

Expand All @@ -212,7 +212,7 @@ class Engine < ::Rails::Engine
date_trunc('day', pa.created_at)::date as day
FROM post_actions as pa
WHERE pa.post_action_type_id = :likes
AND pa.created_at >= :start_date::DATE AND pa.created_at <= :end_date::DATE
AND pa.created_at::DATE >= :start_date::DATE AND pa.created_at::DATE <= :end_date::DATE
GROUP BY day
SQL
start_date: report.start_date.to_date,
Expand Down

0 comments on commit 3411bdd

Please sign in to comment.