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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-22 23:55:00 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-22 23:55:00 +0300
commit43afe46bbd19b1edf60abf3f104fb2b0d29af564 (patch)
treee2a11249408e3403a5a125c50008e77ba1157e57 /lib/gitlab/contributions_calendar.rb
parent20a12438ab470afe1a5736fc46091a6ef4c30073 (diff)
Refactor contributions events and write tests for calendar
Diffstat (limited to 'lib/gitlab/contributions_calendar.rb')
-rw-r--r--lib/gitlab/contributions_calendar.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/gitlab/contributions_calendar.rb b/lib/gitlab/contributions_calendar.rb
index 8ca5115d43a..ea41644811f 100644
--- a/lib/gitlab/contributions_calendar.rb
+++ b/lib/gitlab/contributions_calendar.rb
@@ -14,7 +14,7 @@ module Gitlab
date_from = 1.year.ago
date_to = Date.today
- events = Event.where(author_id: user.id).where(action: event_type).
+ events = Event.contributions.where(author_id: user.id).
where("created_at > ?", date_from).where(project_id: projects)
grouped_events = events.to_a.group_by { |event| event.created_at.to_date.to_s }
@@ -41,7 +41,7 @@ module Gitlab
end
def events_by_date(date)
- events = Event.where(author_id: user.id).where(action: event_type).
+ events = Event.contributions.where(author_id: user.id).
where("created_at > ? AND created_at < ?", date.beginning_of_day, date.end_of_day).
where(project_id: projects)
@@ -57,9 +57,5 @@ module Gitlab
def starting_month
Date.today.strftime("%m").to_i
end
-
- def event_type
- [Event::PUSHED, Event::CREATED, Event::CLOSED, Event::MERGED]
- end
end
end