版本库统计次数刷新版本库的时候自动更新
This commit is contained in:
parent
05cf2d24dc
commit
7697dadbea
|
@ -344,20 +344,15 @@ update
|
|||
#Modified by young
|
||||
# (show_error_not_found; return) unless @entries
|
||||
g = Gitlab.client
|
||||
|
||||
# count = 0
|
||||
# (0..100).each do |page|
|
||||
# if g.commits(@project.gpid,:page => page).count == 0
|
||||
# break
|
||||
# else
|
||||
# count = count + g.commits(@project.gpid,:page => page).count
|
||||
# end
|
||||
# end
|
||||
|
||||
@changesets = g.commits(@project.gpid, :ref_name => @rev)
|
||||
# @changesets = @repository.latest_changesets(@path, @rev)
|
||||
# @changesets_count = @repository.latest_changesets(@path, @rev).count
|
||||
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
|
||||
# 访问该页面的是会后则刷新
|
||||
if @changesets_all_count != @project.commits_count && @changesets_all_count != 0
|
||||
update_commits_count(@project, @changesets_all_count)
|
||||
end
|
||||
# end
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@repositories = @project.repositories
|
||||
|
@ -583,6 +578,10 @@ update
|
|||
end
|
||||
|
||||
private
|
||||
# 更新项目统计数
|
||||
def update_commits_count project, count
|
||||
project.update_attribute(:commits_count, count)
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = Repository.find(params[:id])
|
||||
|
|
Loading…
Reference in New Issue