新增:区块确权贡献者展示逻辑
This commit is contained in:
parent
2977ded4bd
commit
2302ad9b88
|
@ -169,12 +169,18 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def contributors
|
def contributors
|
||||||
if params[:filepath].present? || @project.educoder?
|
cache_result = $redis_cache.get("ProjectSpecialCommit:#{@project.id}")
|
||||||
@contributors = []
|
if cache_result.present?
|
||||||
else
|
@total_count = Project.mindspore_contributors.size
|
||||||
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier, {page: params[:page], limit: params[:limit]})
|
@contributors = kaminari_array_paginate(Project.mindspore_contributors)
|
||||||
@total_count = result[:total_count]
|
else
|
||||||
@contributors = result.is_a?(Hash) ? result[:body] : []
|
if params[:filepath].present? || @project.educoder?
|
||||||
|
@contributors = []
|
||||||
|
else
|
||||||
|
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier, {page: params[:page], limit: params[:limit]})
|
||||||
|
@total_count = result[:total_count]
|
||||||
|
@contributors = result.is_a?(Hash) ? result[:body] : []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
@contributors = []
|
@contributors = []
|
||||||
|
|
|
@ -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