diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index d3336e08..dc8f6dea 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1083,7 +1083,12 @@ end def enroll_list @order = params[:order].blank? ? "desc" : params[:order] @competition = Competition.where(:id => params[:competition]).first - @team_members = @competition.team_members.includes(:user => [:user_extensions => [:school]]) + + @only_teacher = @competition.competition_staffs.count == 1 && @competition.competition_staffs.first.category == 'teacher' + + @team_members = @competition.team_members + @team_members = @team_members.where(is_teacher: false) unless @only_teacher # 只有老师报名时才显示老师,此时老师作为队员 + if params[:school] || params[:location] school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id) school_ids = school_ids.size == 0 ? "(-1)" : "(" + school_ids.join(",") + ")" @@ -1093,7 +1098,7 @@ end @page = params[:page] || 1 @team_members = @team_members.reorder("team_members.created_at #{@order}") all_members = @team_members - @team_members = paginateHelper @team_members, 50 + @team_members = paginateHelper(@team_members.includes(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50) respond_to do |format| format.js format.html diff --git a/app/views/managements/_competition_enroll_list.html.erb b/app/views/managements/_competition_enroll_list.html.erb index e8d605b9..6b67f3b1 100644 --- a/app/views/managements/_competition_enroll_list.html.erb +++ b/app/views/managements/_competition_enroll_list.html.erb @@ -1,7 +1,9 @@ +<% group_mode = @competition.competition_staffs.sum(:maximum) > 1 %> - <% if @competition.max_num > 1 %> + <% if group_mode %> + @@ -20,9 +22,10 @@ <% member_user = member.user %> - <% if @competition.max_num > 1 %> + <% if group_mode %> + - + <% end %>
序号创建者 战队名称 指导老师 队员姓名
<%= (@page.to_i - 1)*50 + index + 1 %><%= member.competition_team.user.show_real_name %> <%= member.competition_team.try(:name) %><%= member.competition_team.teacher.try(:show_real_name) %><%= member.competition_team.teachers.map{|t| t.user.show_real_name}.join(',') %><%= member_user.try(:show_real_name) %> <%= member_user.try(:student_id) %>