BigW Consortium Gitlab

Commit d1f5e81e by Mike Greiling

adjust timezone for date grouping in contributions calendar

parent be77d76e
...@@ -69,9 +69,11 @@ module Gitlab ...@@ -69,9 +69,11 @@ module Gitlab
.and(t[:created_at].lteq(Date.current.end_of_day)) .and(t[:created_at].lteq(Date.current.end_of_day))
.and(t[:author_id].eq(contributor.id)) .and(t[:author_id].eq(contributor.id))
timezone_adjust = "INTERVAL '#{Time.zone.now.utc_offset} SECONDS'"
Event.reorder(nil) Event.reorder(nil)
.select(t[:project_id], t[:target_type], t[:action], 'date(created_at) AS date', 'count(id) as total_amount') .select(t[:project_id], t[:target_type], t[:action], "date(created_at + #{timezone_adjust}) AS date", 'count(id) as total_amount')
.group(t[:project_id], t[:target_type], t[:action], 'date(created_at)') .group(t[:project_id], t[:target_type], t[:action], "date(created_at + #{timezone_adjust})")
.where(conditions) .where(conditions)
.having(t[:project_id].in(Arel::Nodes::SqlLiteral.new(authed_projects.to_sql))) .having(t[:project_id].in(Arel::Nodes::SqlLiteral.new(authed_projects.to_sql)))
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment