modified total commits

This commit is contained in:
huang 2016-07-05 17:35:56 +08:00
parent 6ac7d322b9
commit f50c4a879b
2 changed files with 18 additions and 6 deletions

View File

@ -38,7 +38,7 @@ class RepositoriesController < ApplicationController
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
# 链接gitlab
before_filter :connect_gitlab, :only => [:quality_analysis]
before_filter :connect_gitlab, :only => [:quality_analysis, :show]
accept_rss_auth :revisions
# hidden repositories filter // 隐藏代码过滤器
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
@ -370,11 +370,11 @@ update
if request.xhr?
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
g = Gitlab.client
@changesets = g.commits(@project.gpid, :ref_name => @rev)
g_project = g.project(@project.gpid)
@changesets = @g.commits(@project.gpid, :ref_name => @rev)
g_project = @g.project(@project.gpid)
# 总的提交数
@changesets_all_count = @project.gpid.nil? ? 0 : commit_count(@project, @rev)
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
# @changesets_all_count = @project.gpid.nil? ? 0 : commit_count(@project, @rev)
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
# 访问该页面的是会后则刷新
if @project.project_score.nil?
@ -384,9 +384,10 @@ update
if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
update_commits_count(@project, @changesets_all_count)
end
# 最近一次提交
@changesets_latest_coimmit = @changesets[0]
unless @changesets[0].blank?
unless @changesets_latest_coimmit.blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@creator = User.where("id =?", @project.user_id).first.try(:login)

View File

@ -75,6 +75,17 @@ class Gitlab::Client
end
alias_method :repo_commits, :commits_total_count
# Gets total project commits.
#
# @example
# @param [Integer] project The ID of a project.
# @param [Hash] options A customizable set of options.
# @option options [String] :rev The branch or tag name of a project repository.
# @return [Hash<Gitlab::ObjectifiedHash>]
def user_static(project, options={})
get("/projects/#{project}/repository/user_static", :query => options)
end
# Gets a specific commit identified by the commit hash or name of a branch or tag.
#
# @example