更改:codestats回退
This commit is contained in:
parent
87412643cd
commit
bfe14352c0
|
@ -2,7 +2,7 @@ class Api::V1::Projects::CodeStatsController < Api::V1::BaseController
|
||||||
before_action :require_public_and_member_above, only: [:index]
|
before_action :require_public_and_member_above, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@result_object = Api::V1::Projects::CodeStats::ListService.call(@project, {page: page, limit: limit, ref: params[:ref]}, current_user&.gitea_token)
|
@result_object = Api::V1::Projects::CodeStats::ListService.call(@project, {ref: params[:ref]}, current_user&.gitea_token)
|
||||||
puts @result_object
|
puts @result_object
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -9,8 +9,6 @@ class Api::V1::Projects::CodeStats::ListService < ApplicationService
|
||||||
@owner = project&.owner.login
|
@owner = project&.owner.login
|
||||||
@repo = project&.identifier
|
@repo = project&.identifier
|
||||||
@token = token
|
@token = token
|
||||||
@page = params[:page]
|
|
||||||
@limit = params[:limit]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
|
@ -22,9 +20,7 @@ class Api::V1::Projects::CodeStats::ListService < ApplicationService
|
||||||
private
|
private
|
||||||
def request_params
|
def request_params
|
||||||
param = {
|
param = {
|
||||||
access_token: token,
|
access_token: token
|
||||||
page: page,
|
|
||||||
limit: limit
|
|
||||||
}
|
}
|
||||||
param.merge!(ref: ref) if ref.present?
|
param.merge!(ref: ref) if ref.present?
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
json.total_count @result_object[:total_data].to_i
|
json.author_count @result_object["author_count"]
|
||||||
json.author_count @result_object[:data]["author_count"]
|
json.commit_count @result_object["commit_count"]
|
||||||
json.commit_count @result_object[:data]["commit_count"]
|
json.change_files @result_object["change_files"]
|
||||||
json.change_files @result_object[:data]["change_files"]
|
json.additions @result_object["additions"]
|
||||||
json.additions @result_object[:data]["additions"]
|
json.deletions @result_object["deletions"]
|
||||||
json.deletions @result_object[:data]["deletions"]
|
json.commit_count_in_all_branches @result_object["commit_count_in_all_branches"]
|
||||||
json.commit_count_in_all_branches @result_object[:data]["commit_count_in_all_branches"]
|
json.authors @result_object["authors"].each do |author|
|
||||||
json.authors @result_object[:data]["authors"].each do |author|
|
|
||||||
json.author do
|
json.author do
|
||||||
json.partial! 'api/v1/users/commit_user_email', locals: { user: render_cache_commit_author(author), name: author['name'], email: author['email'] }
|
json.partial! 'api/v1/users/commit_user_email', locals: { user: render_cache_commit_author(author), name: author['name'], email: author['email'] }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue