Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5c5fc89b
Commit
5c5fc89b
authored
Mar 05, 2018
by
Riccardo Padovani
Committed by
Sean McGivern
Mar 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#43691: DiffNotes not counted by ContributionsCalendar
parent
5492ea17
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml
...ased/feature--43691-count-diff-note-calendar-activity.yml
+5
-0
lib/gitlab/contributions_calendar.rb
lib/gitlab/contributions_calendar.rb
+1
-1
spec/lib/gitlab/contributions_calendar_spec.rb
spec/lib/gitlab/contributions_calendar_spec.rb
+10
-4
No files found.
changelogs/unreleased/feature--43691-count-diff-note-calendar-activity.yml
0 → 100644
View file @
5c5fc89b
---
title
:
Count comments on diffs as contributions for the contributions calendar
merge_request
:
17418
author
:
Riccardo Padovani
type
:
fixed
lib/gitlab/contributions_calendar.rb
View file @
5c5fc89b
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
mr_events
=
event_counts
(
date_from
,
:merge_requests
)
mr_events
=
event_counts
(
date_from
,
:merge_requests
)
.
having
(
action:
[
Event
::
MERGED
,
Event
::
CREATED
,
Event
::
CLOSED
],
target_type:
"MergeRequest"
)
.
having
(
action:
[
Event
::
MERGED
,
Event
::
CREATED
,
Event
::
CLOSED
],
target_type:
"MergeRequest"
)
note_events
=
event_counts
(
date_from
,
:merge_requests
)
note_events
=
event_counts
(
date_from
,
:merge_requests
)
.
having
(
action:
[
Event
::
COMMENTED
],
target_type:
"Note"
)
.
having
(
action:
[
Event
::
COMMENTED
],
target_type:
%w(Note DiffNote)
)
union
=
Gitlab
::
SQL
::
Union
.
new
([
repo_events
,
issue_events
,
mr_events
,
note_events
])
union
=
Gitlab
::
SQL
::
Union
.
new
([
repo_events
,
issue_events
,
mr_events
,
note_events
])
events
=
Event
.
find_by_sql
(
union
.
to_sql
).
map
(
&
:attributes
)
events
=
Event
.
find_by_sql
(
union
.
to_sql
).
map
(
&
:attributes
)
...
...
spec/lib/gitlab/contributions_calendar_spec.rb
View file @
5c5fc89b
...
@@ -11,7 +11,7 @@ describe Gitlab::ContributionsCalendar do
...
@@ -11,7 +11,7 @@ describe Gitlab::ContributionsCalendar do
end
end
let
(
:public_project
)
do
let
(
:public_project
)
do
create
(
:project
,
:public
)
do
|
project
|
create
(
:project
,
:public
,
:repository
)
do
|
project
|
create
(
:project_member
,
user:
contributor
,
project:
project
)
create
(
:project_member
,
user:
contributor
,
project:
project
)
end
end
end
end
...
@@ -40,13 +40,13 @@ describe Gitlab::ContributionsCalendar do
...
@@ -40,13 +40,13 @@ describe Gitlab::ContributionsCalendar do
described_class
.
new
(
contributor
,
current_user
)
described_class
.
new
(
contributor
,
current_user
)
end
end
def
create_event
(
project
,
day
,
hour
=
0
)
def
create_event
(
project
,
day
,
hour
=
0
,
action
=
Event
::
CREATED
,
target_symbol
=
:issue
)
@targets
||=
{}
@targets
||=
{}
@targets
[
project
]
||=
create
(
:issue
,
project:
project
,
author:
contributor
)
@targets
[
project
]
||=
create
(
target_symbol
,
project:
project
,
author:
contributor
)
Event
.
create!
(
Event
.
create!
(
project:
project
,
project:
project
,
action:
Event
::
CREATED
,
action:
action
,
target:
@targets
[
project
],
target:
@targets
[
project
],
author:
contributor
,
author:
contributor
,
created_at:
DateTime
.
new
(
day
.
year
,
day
.
month
,
day
.
day
,
hour
)
created_at:
DateTime
.
new
(
day
.
year
,
day
.
month
,
day
.
day
,
hour
)
...
@@ -71,6 +71,12 @@ describe Gitlab::ContributionsCalendar do
...
@@ -71,6 +71,12 @@ describe Gitlab::ContributionsCalendar do
expect
(
calendar
(
contributor
).
activity_dates
[
today
]).
to
eq
(
2
)
expect
(
calendar
(
contributor
).
activity_dates
[
today
]).
to
eq
(
2
)
end
end
it
"counts the diff notes on merge request"
do
create_event
(
public_project
,
today
,
0
,
Event
::
COMMENTED
,
:diff_note_on_merge_request
)
expect
(
calendar
(
contributor
).
activity_dates
[
today
]).
to
eq
(
1
)
end
context
"when events fall under different dates depending on the time zone"
do
context
"when events fall under different dates depending on the time zone"
do
before
do
before
do
create_event
(
public_project
,
today
,
1
)
create_event
(
public_project
,
today
,
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment