新增:区块确权贡献者展示逻辑

This commit is contained in:
yystopf 2023-03-23 17:01:19 +08:00
parent 2302ad9b88
commit 64d9d21457
2 changed files with 8 additions and 2 deletions

View File

@ -169,8 +169,8 @@ class RepositoriesController < ApplicationController
end end
def contributors def contributors
cache_result = $redis_cache.get("ProjectSpecialCommit:#{@project.id}") @cache_result = $redis_cache.get("ProjectSpecialCommit:#{@project.id}")
if cache_result.present? if @cache_result.present?
@total_count = Project.mindspore_contributors.size @total_count = Project.mindspore_contributors.size
@contributors = kaminari_array_paginate(Project.mindspore_contributors) @contributors = kaminari_array_paginate(Project.mindspore_contributors)
else else

View File

@ -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"]