diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 5d9528f87..d4042abf5 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -77,7 +77,7 @@ class RepositoriesController < ApplicationController respond_to do |format| format.html format.xls{ - filename = "#{@project.name.to_s}_#{l(:label_issue_list_xls)}_#{@rev}_#{l(:label_rep_xls)}.xls" + filename = "#{@project.name.to_s}_#{l(:label_rep_xls)}.xls" send_data(export_rep_xls(gpid, :rev => rev, :cycle => "1"), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 573a7ba1f..6215a79d0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -68,29 +68,31 @@ module ApplicationHelper g = Gitlab.client cycle = params[:cycle] rev = params[:rev] - # branch = g.branche(gpid, rev) - statics = g.rep_stats(gpid, :rev => rev) - + if cycle == "week" + statics = g.rep_stats_week(gpid, :rev => rev) + elsif cycle == "month" + statics = g.rep_stats_month(gpid, :rev => rev) + end xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "版本库" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_author_mail),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle)]) + sheet1.row(0).concat([l(:rep_branch),l(:rep_author),l(:rep_changeset),l(:rep_code_add),l(:rep_code_delete),l(:rep_code_modified),l(:rep_sode_time),l(:rep_sode_cycle),l(:rep_author_mail)]) count_row = 1 statics.each do |static| user = User.where(:mail => static.email).first sheet1[count_row,0] = rev sheet1[count_row,1] = user.nil? ? static.uname : user.show_name - sheet1[count_row,2] = static.email + sheet1[count_row,2] = static.commits_num sheet1[count_row,3] = static.add sheet1[count_row,4] = static.del sheet1[count_row,5] = static.changes - sheet1[count_row,6] = Time.now - sheet1[count_row,7] = "1周" + sheet1[count_row,6] = Time.now.strftime('%Y-%m-%d %H:%M:%S') + sheet1[count_row,7] = cycle == "week" ? "最近1周" : "最近一月" + sheet1[count_row,8] = static.email count_row += 1 end - book.write xls_report xls_report.string end diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 21db53a31..b12302e6e 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -80,8 +80,8 @@ 如何提交代码