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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
e145f46a
Commit
e145f46a
authored
Sep 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix contributors api
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
57c0d9ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
8 deletions
+6
-8
app/models/repository.rb
app/models/repository.rb
+4
-6
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+2
-2
No files found.
app/models/repository.rb
View file @
e145f46a
...
@@ -250,20 +250,18 @@ class Repository
...
@@ -250,20 +250,18 @@ class Repository
end
end
def
contributors
def
contributors
log
=
graph_log
.
group_by
{
|
i
|
i
[
:author_email
]
}
commits
=
self
.
commits
(
nil
,
nil
,
2000
,
0
,
true
)
log
.
map
do
|
email
,
contribution
s
|
commits
.
group_by
(
&
:author_email
).
map
do
|
email
,
commit
s
|
contributor
=
Gitlab
::
Contributor
.
new
contributor
=
Gitlab
::
Contributor
.
new
contributor
.
email
=
email
contributor
.
email
=
email
co
ntributions
.
each
do
|
contribution
|
co
mmits
.
each
do
|
commit
|
if
contributor
.
name
.
blank?
if
contributor
.
name
.
blank?
contributor
.
name
=
co
ntribution
[
:author_name
]
contributor
.
name
=
co
mmit
.
author_name
end
end
contributor
.
commits
+=
1
contributor
.
commits
+=
1
contributor
.
additions
+=
contribution
[
:additions
]
||
0
contributor
.
deletions
+=
contribution
[
:deletions
]
||
0
end
end
contributor
contributor
...
...
spec/requests/api/repositories_spec.rb
View file @
e145f46a
...
@@ -224,8 +224,8 @@ describe API::API, api: true do
...
@@ -224,8 +224,8 @@ describe API::API, api: true do
contributor
[
'email'
].
should
==
'dmitriy.zaporozhets@gmail.com'
contributor
[
'email'
].
should
==
'dmitriy.zaporozhets@gmail.com'
contributor
[
'name'
].
should
==
'Dmitriy Zaporozhets'
contributor
[
'name'
].
should
==
'Dmitriy Zaporozhets'
contributor
[
'commits'
].
should
==
13
contributor
[
'commits'
].
should
==
13
contributor
[
'additions'
].
should
==
4081
contributor
[
'additions'
].
should
==
0
contributor
[
'deletions'
].
should
==
29
contributor
[
'deletions'
].
should
==
0
end
end
end
end
end
end
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