|
|
|
@ -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
|
|
|
|
|