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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
09ccf6cc
Commit
09ccf6cc
authored
Oct 10, 2016
by
Georg G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Linguist::Language[] instead of creating a hash
parent
35304897
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
5 deletions
+2
-5
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+1
-5
No files found.
CHANGELOG
View file @
09ccf6cc
...
...
@@ -36,6 +36,7 @@ v 8.13.0 (unreleased)
- Close open merge request without source project (Katarzyna Kobierska Ula Budziszewska)
- Fix that manual jobs would no longer block jobs in the next stage. !6604
- Add configurable email subject suffix (Fu Xu)
- Use defined colour for a language when available !6748 (nilsding)
- Added tooltip to fork count on project show page. (Justin DiPierro)
- Use a ConnectionPool for Rails.cache on Sidekiq servers
- Replace `alias_method_chain` with `Module#prepend`
...
...
app/controllers/projects/graphs_controller.rb
View file @
09ccf6cc
...
...
@@ -35,14 +35,10 @@ class Projects::GraphsController < Projects::ApplicationController
def
languages
@languages
=
Linguist
::
Repository
.
new
(
@repository
.
rugged
,
@repository
.
rugged
.
head
.
target_id
).
languages
total
=
@languages
.
map
(
&
:last
).
sum
colors
=
Linguist
::
Language
.
colors
.
select
{
|
lang
|
@languages
.
include?
lang
.
name
}.
map
{
|
lang
|
[
lang
.
name
,
lang
.
color
]
}.
to_h
@languages
=
@languages
.
map
do
|
language
|
name
,
share
=
language
color
=
colors
[
name
]
||
"#
#{
Digest
::
SHA256
.
hexdigest
(
name
)[
0
...
6
]
}
"
color
=
Linguist
::
Language
[
name
].
color
||
"#
#{
Digest
::
SHA256
.
hexdigest
(
name
)[
0
...
6
]
}
"
{
value:
(
share
.
to_f
*
100
/
total
).
round
(
2
),
label:
name
,
...
...
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