Browse Source

更改:codestats回退

pull/342/head
yystopf 3 years ago
parent
commit
bfe14352c0
3 changed files with 9 additions and 14 deletions
  1. +1
    -1
      app/controllers/api/v1/projects/code_stats_controller.rb
  2. +1
    -5
      app/services/api/v1/projects/code_stats/list_service.rb
  3. +7
    -8
      app/views/api/v1/projects/code_stats/index.json.jbuilder

+ 1
- 1
app/controllers/api/v1/projects/code_stats_controller.rb View File

@@ -2,7 +2,7 @@ class Api::V1::Projects::CodeStatsController < Api::V1::BaseController
before_action :require_public_and_member_above, only: [: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
end
end

+ 1
- 5
app/services/api/v1/projects/code_stats/list_service.rb View File

@@ -9,8 +9,6 @@ class Api::V1::Projects::CodeStats::ListService < ApplicationService
@owner = project&.owner.login
@repo = project&.identifier
@token = token
@page = params[:page]
@limit = params[:limit]
end

def call
@@ -22,9 +20,7 @@ class Api::V1::Projects::CodeStats::ListService < ApplicationService
private
def request_params
param = {
access_token: token,
page: page,
limit: limit
access_token: token
}
param.merge!(ref: ref) if ref.present?



+ 7
- 8
app/views/api/v1/projects/code_stats/index.json.jbuilder View File

@@ -1,11 +1,10 @@
json.total_count @result_object[:total_data].to_i
json.author_count @result_object[:data]["author_count"]
json.commit_count @result_object[:data]["commit_count"]
json.change_files @result_object[:data]["change_files"]
json.additions @result_object[:data]["additions"]
json.deletions @result_object[:data]["deletions"]
json.commit_count_in_all_branches @result_object[:data]["commit_count_in_all_branches"]
json.authors @result_object[:data]["authors"].each do |author|
json.author_count @result_object["author_count"]
json.commit_count @result_object["commit_count"]
json.change_files @result_object["change_files"]
json.additions @result_object["additions"]
json.deletions @result_object["deletions"]
json.commit_count_in_all_branches @result_object["commit_count_in_all_branches"]
json.authors @result_object["authors"].each do |author|
json.author do
json.partial! 'api/v1/users/commit_user_email', locals: { user: render_cache_commit_author(author), name: author['name'], email: author['email'] }
end


Loading…
Cancel
Save