超级管理员界面提供导出每个用户提交次数代码次数

This commit is contained in:
huang 2016-11-02 21:30:14 +08:00
parent a9e62618f1
commit 1afc3fe4d0
1 changed files with 25 additions and 1 deletions

View File

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