Merge remote-tracking branch 'origin/trustie_server' into trustie_server
This commit is contained in:
commit
c7e2ae0699
|
@ -169,6 +169,11 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def contributors
|
def contributors
|
||||||
|
@cache_result = $redis_cache.get("ProjectSpecialCommit:#{@project.id}")
|
||||||
|
if @cache_result.present?
|
||||||
|
@total_count = Project.mindspore_contributors.size
|
||||||
|
@contributors = kaminari_array_paginate(Project.mindspore_contributors)
|
||||||
|
else
|
||||||
if params[:filepath].present? || @project.educoder?
|
if params[:filepath].present? || @project.educoder?
|
||||||
@contributors = []
|
@contributors = []
|
||||||
else
|
else
|
||||||
|
@ -176,6 +181,7 @@ class RepositoriesController < ApplicationController
|
||||||
@total_count = result[:total_count]
|
@total_count = result[:total_count]
|
||||||
@contributors = result.is_a?(Hash) ? result[:body] : []
|
@contributors = result.is_a?(Hash) ? result[:body] : []
|
||||||
end
|
end
|
||||||
|
end
|
||||||
rescue
|
rescue
|
||||||
@contributors = []
|
@contributors = []
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,12 @@ if user.blank?
|
||||||
json.type nil
|
json.type nil
|
||||||
json.name contributor["login"]
|
json.name contributor["login"]
|
||||||
json.image_url User::Avatar.get_letter_avatar_url(contributor["login"])
|
json.image_url User::Avatar.get_letter_avatar_url(contributor["login"])
|
||||||
|
if @cache_result.present?
|
||||||
|
db_user = User.find_by_id(contributor["id"])
|
||||||
|
if db_user.present?
|
||||||
|
json.contribution_perc db_user.contribution_perc(project)
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
json.contributions contributor["contributions"]
|
json.contributions contributor["contributions"]
|
||||||
# json.gid contributor["id"]
|
# json.gid contributor["id"]
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace :sync_mindspore do
|
||||||
total_contributions = contributions.sum{|i| i["contributions"]}
|
total_contributions = contributions.sum{|i| i["contributions"]}
|
||||||
contributions.each do |con|
|
contributions.each do |con|
|
||||||
cont_balance = Float(con["contributions"]*9900/total_contributions).round(0)
|
cont_balance = Float(con["contributions"]*9900/total_contributions).round(0)
|
||||||
token_balance << [con["id"], cont_balance] if cont_balance > 0
|
token_balance << [con["id"].to_s, cont_balance] if cont_balance > 0
|
||||||
end
|
end
|
||||||
params = {
|
params = {
|
||||||
"request-type": "create repo",
|
"request-type": "create repo",
|
||||||
|
|
Loading…
Reference in New Issue