From 1afc3fe4d0e3cac7ad2e61fc5c98c4e35a97db72 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 2 Nov 2016 21:30:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=8F=90=E4=BE=9B=E5=AF=BC=E5=87=BA=E6=AF=8F?= =?UTF-8?q?=E4=B8=AA=E7=94=A8=E6=88=B7=E6=8F=90=E4=BA=A4=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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功能