仓库语言缓存随着项目数变化,计算调整
This commit is contained in:
parent
1bfaa44af5
commit
9630fbfec5
|
@ -94,9 +94,10 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
||||||
|
|
||||||
languages_hash = languages_hash.sort { |x, y| y[1] <=> x[1] }
|
languages_hash = languages_hash.sort { |x, y| y[1] <=> x[1] }
|
||||||
sort_hash = Hash[*languages_hash.flatten]
|
sort_hash = Hash[*languages_hash.flatten]
|
||||||
|
total_byte_size = sort_hash.values.sum
|
||||||
# Rails.logger.info "languages_hash=============#{sort_hash}"
|
# Rails.logger.info "languages_hash=============#{sort_hash}"
|
||||||
sort_hash= sort_hash.transform_values { |v|
|
sort_hash= sort_hash.transform_values { |v|
|
||||||
ActionController::Base.helpers.number_to_percentage((v / projects_count), precision: 1)
|
ActionController::Base.helpers.number_to_percentage((v / total_byte_size), precision: 1)
|
||||||
}.select { |k, v| v != "0.0%" }
|
}.select { |k, v| v != "0.0%" }
|
||||||
render json: sort_hash
|
render json: sort_hash
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue