Skip to content

Commit

Permalink
Fix: time_to_first_response report
Browse files Browse the repository at this point in the history
  • Loading branch information
hooopo committed May 19, 2021
1 parent 72f58c5 commit cf1a001
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ def message_archived?(user)
TIME_TO_FIRST_RESPONSE_SQL ||= <<-SQL
SELECT AVG(t.hours) AS "hours", t.created_at AS "date"
FROM (
SELECT t.id, date(t.created_at) AS created_at, TIMESTAMPDIFF(second, MIN(p.created_at), t.created_at) / 3600.0 AS "hours"
SELECT t.id, date(t.created_at) AS created_at, TIMESTAMPDIFF(second, t.created_at, MIN(p.created_at)) / 3600.0 AS "hours"
FROM topics t
LEFT JOIN posts p ON p.topic_id = t.id
/*where*/
Expand All @@ -1249,7 +1249,7 @@ def message_archived?(user)
TIME_TO_FIRST_RESPONSE_TOTAL_SQL ||= <<-SQL
SELECT AVG(t.hours) AS "hours"
FROM (
SELECT t.id, TIMESTAMPDIFF(second, MIN(p.created_at), t.created_at) / 3600.0 AS "hours"
SELECT t.id, TIMESTAMPDIFF(second, t.created_at, MIN(p.created_at)) / 3600.0 AS "hours"
FROM topics t
LEFT JOIN posts p ON p.topic_id = t.id
/*where*/
Expand Down

0 comments on commit cf1a001

Please sign in to comment.