版本库首页没有统计commit_count,具体的详情页在开始统计

This commit is contained in:
houxiang 2015-12-08 15:56:31 +08:00
parent 6fad26cabf
commit 56cb83ffba
3 changed files with 45 additions and 45 deletions

View File

@ -347,27 +347,13 @@ update
# 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
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(@project.gpid , :page=>75).count ==0
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
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) @changesets = g.commits(@project.gpid)
# @changesets = @repository.latest_changesets(@path, @rev) # @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count # @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_all_count = count @changesets_all_count = 0
@changesets_latest_coimmit = @changesets[0] @changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev) @properties = @repository.properties(@path, @rev)
@repositories = @project.repositories @repositories = @project.repositories
@ -410,8 +396,28 @@ update
limit = 20 limit = 20
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来 #每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s) @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
#add by hx
if g.commits(@project.gpid , :page=>200).count > 0
count = 4020
elsif g.commits(@project.gpid , :page=>25).count==0
count = count_commits(@project.gpid , 0 , 25)
elsif g.commits(@project.gpid , :page=>50).count ==0
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(@project.gpid , :page=>75).count ==0
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
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
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化 #页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
@commits_count = params[:commit_count].to_i @commits_count = count
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page] @commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
@commit = g.commit(@project.gpid,@rev) @commit = g.commit(@project.gpid,@rev)

View File

@ -52,7 +52,8 @@
</span> </span>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit"> <span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font> 提交
<%=link_to"全部提交次数", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
</span> </span>
</div> </div>

View File

@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id" add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "dts", :force => true do |t| create_table "dts", :primary_key => "Num", :force => true do |t|
t.string "IPLineCode" t.string "Defect", :limit => 50
t.string "Description" t.string "Category", :limit => 50
t.string "Num"
t.string "Variable"
t.string "TraceInfo"
t.string "Method"
t.string "File" t.string "File"
t.string "IPLine" t.string "Method"
t.string "Review" t.string "Module", :limit => 20
t.string "Category" t.string "Variable", :limit => 50
t.string "Defect" t.integer "StartLine"
t.string "PreConditions" t.integer "IPLine"
t.string "StartLine" t.string "IPLineCode", :limit => 200
t.string "Judge", :limit => 15
t.integer "Review", :limit => 1
t.string "Description"
t.text "PreConditions", :limit => 2147483647
t.text "TraceInfo", :limit => 2147483647
t.text "Code", :limit => 2147483647
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.integer "id", :null => false
end end
create_table "enabled_modules", :force => true do |t| create_table "enabled_modules", :force => true do |t|
@ -891,16 +894,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t| create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id" t.integer "journal_id"
t.integer "user_id" t.integer "user_id"
@ -970,7 +963,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
t.integer "course_group_id", :default => 0 t.integer "course_group_id", :default => 0
end end
add_index "members", ["course_id"], :name => "index_members_on_course_id"
add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["project_id"], :name => "index_members_on_project_id"
add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
add_index "members", ["user_id"], :name => "index_members_on_user_id" add_index "members", ["user_id"], :name => "index_members_on_user_id"
@ -1519,6 +1511,7 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
end end
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
add_index "student_works", ["homework_common_id"], :name => "index"
create_table "student_works_evaluation_distributions", :force => true do |t| create_table "student_works_evaluation_distributions", :force => true do |t|
t.integer "student_work_id" t.integer "student_work_id"