Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Sen <sen@senorsen.com>2015-04-24 13:27:52 +0300
committerSenorsen <sen@senorsen.com>2015-04-25 15:13:52 +0300
commit0cbafa4d65c31feef9e9651c40eca5dc820bc9ed (patch)
treebd357d73d15d4d2e543517c627da3e651158c2d1 /lib/gitlab/contributions_calendar.rb
parent0e998876d842bd4d8b172b73eef86b30f397b009 (diff)
Fix contributions calendar empty problem under mysql
When using MySQL as database backend in GitLab, ``date`` in ``date(created_at), count(id) as total_amount`` won't return the ``date`` column (should be ``date(created_at)``), as a result, there's no contribution in the user profile page. Adding an ``as date`` can solve this problem.
Diffstat (limited to 'lib/gitlab/contributions_calendar.rb')
-rw-r--r--lib/gitlab/contributions_calendar.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/contributions_calendar.rb b/lib/gitlab/contributions_calendar.rb
index 3fd0823df06..45bb904ed7a 100644
--- a/lib/gitlab/contributions_calendar.rb
+++ b/lib/gitlab/contributions_calendar.rb
@@ -17,7 +17,7 @@ module Gitlab
events = Event.reorder(nil).contributions.where(author_id: user.id).
where("created_at > ?", date_from).where(project_id: projects).
group('date(created_at)').
- select('date(created_at), count(id) as total_amount').
+ select('date(created_at) as date, count(id) as total_amount').
map(&:attributes)
dates = (1.year.ago.to_date..(Date.today + 1.day)).to_a