Commit e2bdce8d authored by Riccardo Padovani's avatar Riccardo Padovani Committed by Sean McGivern

Count discussions on issues and merge requests as contributions for the contributions calendar

parent cfe203fa
---
title: Count comments on diffs as contributions for the contributions calendar
title: Count comments on diffs and discussions as contributions for the contributions calendar
merge_request: 17418
author: Riccardo Padovani
type: fixed
......@@ -23,7 +23,7 @@ module Gitlab
mr_events = event_counts(date_from, :merge_requests)
.having(action: [Event::MERGED, Event::CREATED, Event::CLOSED], target_type: "MergeRequest")
note_events = event_counts(date_from, :merge_requests)
.having(action: [Event::COMMENTED], target_type: %w(Note DiffNote))
.having(action: [Event::COMMENTED])
union = Gitlab::SQL::Union.new([repo_events, issue_events, mr_events, note_events])
events = Event.find_by_sql(union.to_sql).map(&:attributes)
......
......@@ -77,6 +77,13 @@ describe Gitlab::ContributionsCalendar do
expect(calendar(contributor).activity_dates[today]).to eq(1)
end
it "counts the discussions on merge requests and issues" do
create_event(public_project, today, 0, Event::COMMENTED, :discussion_note_on_merge_request)
create_event(public_project, today, 2, Event::COMMENTED, :discussion_note_on_issue)
expect(calendar(contributor).activity_dates[today]).to eq(2)
end
context "when events fall under different dates depending on the time zone" do
before do
create_event(public_project, today, 1)
......
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