Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg G <nilsding@nilsding.org>2016-10-10 17:18:26 +0300
committerGeorg G <nilsding@nilsding.org>2016-10-10 17:18:26 +0300
commit09ccf6cce3e191f5971c96f1ce8b227a8f3682af (patch)
treeef5f10e519ab0b981bc0429418e7ce572cf378f9 /app/controllers/projects/graphs_controller.rb
parent3530489761fbf892adbf335fe65c0c73b978da39 (diff)
Use Linguist::Language[] instead of creating a hash
Diffstat (limited to 'app/controllers/projects/graphs_controller.rb')
-rw-r--r--app/controllers/projects/graphs_controller.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/controllers/projects/graphs_controller.rb b/app/controllers/projects/graphs_controller.rb
index f4f2e5841a0..923e7340e69 100644
--- a/app/controllers/projects/graphs_controller.rb
+++ b/app/controllers/projects/graphs_controller.rb
@@ -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,