diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5ee452e87..20173d5c1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -117,7 +117,31 @@ module ApplicationHelper # 管理员界面导出所有项目代码、提交次数统计 def admin_export_rep_xls - members = Member.where(:course_id => -1) + users = User.all + user_details = {} + results = [] + users.each do |user| + user.projects.each do |project| + g = Gitlab.client + cycle = params[:cycle] + rev = params[:rev] + if cycle == "week" + statics = g.rep_stats_week(project.gpid, :rev => rev) + elsif cycle == "month" + statics = g.rep_stats_month(project.gpid, :rev => rev) + end. + user_details = {:user_id => user.id, :user_name => user.show_name, :project_id => project.id, :project_name => project.name, + :commits_num => static.commits_num, :add => static.add, :del => static.del, :changes => static.changes} + results << user_details + end + + static.commits_num + sheet1[count_row,3] = static.add + sheet1[count_row,4] = static.del + sheet1[count_row,5] = static.changes + + end + end end # 项目issue列表导出Excel功能