modify management competition

dev_aliyun
p31729568 5 years ago
parent bf659d0a70
commit 505d1dd132

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

@ -1,7 +1,9 @@
<% group_mode = @competition.competition_staffs.sum(:maximum) > 1 %>
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0">
<thead>
<th>序号</th>
<% if @competition.max_num > 1 %>
<% if group_mode %>
<th>创建者</th>
<th>战队名称</th>
<th>指导老师</th>
<th>队员姓名</th>
@ -20,9 +22,10 @@
<% member_user = member.user %>
<tr>
<td><%= (@page.to_i - 1)*50 + index + 1 %></td>
<% if @competition.max_num > 1 %>
<% if group_mode %>
<td><%= member.competition_team.user.show_real_name %></td>
<td><%= member.competition_team.try(:name) %></td>
<td><%= member.competition_team.teacher.try(:show_real_name) %></td>
<td><%= member.competition_team.teachers.map{|t| t.user.show_real_name}.join(',') %></td>
<% end %>
<td><%= member_user.try(:show_real_name) %></td>
<td><%= member_user.try(:student_id) %></td>

Loading…
Cancel
Save