finalize the commit_counts problems by hx

This commit is contained in:
huang 2015-11-23 21:07:43 +08:00
parent c3bbf3490f
commit 3af96c96e7
1 changed files with 17 additions and 1 deletions

View File

@ -315,6 +315,17 @@ 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
#add by hx
if g.commits(@project.gpid , :page=>25).count==0
count = count_commits(@project.gpid , 0 , 25)
elsif g.commits(@project.gpid , :page=>50).count ==0
@ -323,8 +334,12 @@ update
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
elsif g.commits(@project.gpid , :page=>100).count== 0
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
else
elsif g.commits(@project.gpid , :page=>125).count==0
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
elsif g.commits(@project.gpid , :page=>150).count==0
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
else
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
end
@changesets = g.commits(@project.gpid)
@ -353,6 +368,7 @@ update
alias_method :browse, :show
#add by hx
def count_commits(project_id , left , right)
count = 0
(left..right).each do |page|