提交 e2bdce8d 编写于 作者: R Riccardo Padovani 提交者: Sean McGivern

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

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册