|
|
|
@ -63,6 +63,67 @@ module ApplicationHelper
|
|
|
|
|
result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 项目版本库导出Excel功能
|
|
|
|
|
def export_rep_xls(gpid, options = {})
|
|
|
|
|
g = Gitlab.client
|
|
|
|
|
cycle = params[:cycle]
|
|
|
|
|
rev = params[:rev]
|
|
|
|
|
# branch = g.branche(gpid, rev)
|
|
|
|
|
statics = g.rep_stats(gpid, :rev => rev)
|
|
|
|
|
|
|
|
|
|
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)])
|
|
|
|
|
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,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周"
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 项目issue列表导出Excel功能
|
|
|
|
|
def issue_list_xls issues
|
|
|
|
|
xls_report = StringIO.new
|
|
|
|
|
book = Spreadsheet::Workbook.new
|
|
|
|
|
sheet1 = book.create_worksheet :name => "issues"
|
|
|
|
|
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
|
|
|
|
sheet1.row(0).default_format = blue
|
|
|
|
|
sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:issue_xls_version),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)])
|
|
|
|
|
count_row = 1
|
|
|
|
|
issues.each do |issue|
|
|
|
|
|
sheet1[count_row,0] = issue.id
|
|
|
|
|
sheet1[count_row,1] = issue_tracker_change(issue.tracker_id)
|
|
|
|
|
sheet1[count_row,2] = issue.subject
|
|
|
|
|
sheet1[count_row,3] = issue.description
|
|
|
|
|
sheet1[count_row,4] = issue_status_change(issue.status_id)
|
|
|
|
|
sheet1[count_row,5] = issue.assigned_to.try(:show_name)
|
|
|
|
|
sheet1[count_row,6] = issue_priority_change(issue.priority_id)
|
|
|
|
|
sheet1[count_row,7] = issue.author.show_name
|
|
|
|
|
sheet1[count_row,8] = issue.created_on
|
|
|
|
|
sheet1[count_row,9] = issue.fixed_version.try(:name)
|
|
|
|
|
sheet1[count_row,10] = issue.start_date
|
|
|
|
|
sheet1[count_row,11] = issue.due_date
|
|
|
|
|
sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id)
|
|
|
|
|
count_row += 1
|
|
|
|
|
end
|
|
|
|
|
book.write xls_report
|
|
|
|
|
xls_report.string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 获取用户单位
|
|
|
|
|
# 优先获取高校信息,如果改信息不存在则获取occupation
|
|
|
|
|
def get_occupation_from_user user
|
|
|
|
|