fix competition eroll list

dev_bj
p31729568 6 years ago
parent d6340bb6d6
commit df19291d2c

@ -112,7 +112,10 @@ class CompetitionsController < ApplicationController
@is_enroll = CompetitionTeam.where(:id => TeamMember.where(:user_id => @user, :competition_team_id => @competition.competition_teams.map(&:id)).pluck(:competition_team_id)).reorder("created_at desc")
@show_notice = (@competition.identifier == "gcc-dev-2018" || @competition.identifier == "gcc-annotation-2018") &&
@competition.competition_teams.joins(:team_members).where(:user_id => User.current.id).group('competition_teams.id').sum('IF(team_members.is_teacher=1, 1, 0)').values.any?(&:zero?)
@teams = paginateHelper @teams, 50
@teams = paginateHelper @teams.includes(:user, teachers: :user, members: :user), 50
@minimum_staff = @competition.competition_staffs.sum(:minimum)
@maximum_staff = @competition.competition_staffs.sum(:maximum)
respond_to do |format|
format.js
format.html

@ -5,19 +5,19 @@
<% @teams.each do |team| %>
<li class="clearfix">
<%= link_to image_tag(url_to_avatar(team.user), :width => "40", :height => "40", :class => "radius fl mr10"), user_path(team.user), :title => team.user.show_name, :target => "_blank", :alt => "用户头像" %>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @competition.max_num > 1 ? team.name : team.user.show_name %>"><%= @competition.max_num > 1 ? team.name : team.user.show_name %></span>
<% if @competition.max_num > 1 %>
<span class="fl mr40 mt10" style="width: 270px;">
<% if team.teacher_id.present? %>
<a href="<%= user_path(team.teacher) %>" class="fl" target="_blank" data-tip-down="指导老师:<%= team.teacher.show_name %>"><%= image_tag(url_to_avatar(team.teacher), :width => "26", :height => "26", :class => "radius fl mr4") %></a>
<% end %>
<% team.team_members.where("user_id != #{team.teacher_id.present? ? team.teacher_id : '-1'}")[0, 9].each do |member| %>
<%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr4 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %>
<% end %>
<% if team.team_members.size > 9 %>
<span class="team-p-s mt3">...</span>
<% end %>
</span>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @maximum_staff > 1 ? team.name : team.user.show_name %>"><%= @maximum_staff > 1 ? team.name : team.user.show_name %></span>
<% if @maximum_staff > 1 %>
<span class="fl mr40 mt10" style="width: 270px;">
<% team.teachers.each do |teacher| %>
<%= link_to image_tag(url_to_avatar(teacher.user), width: 26, height: 26, class: 'radius fl mr4'), user_path(teacher.user), class: 'fl', target: '_blank', data: { 'tip-down' => "指导老师:#{teacher.user.show_name}" } %>
<% end %>
<% team.members.each do |member| %>
<%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr4 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %>
<% end %>
<% if team.members.size > 9 %>
<span class="team-p-s mt3">...</span>
<% end %>
</span>
<% end %>
<span class="color-grey-6 fl edu-txt-left task-hide mt10" style="width: 180px;"><%= team.user.school_name %></span>
<span class="color-grey-9 fr mt10"><%= format_time team.created_at %></span>

@ -1,7 +1,7 @@
<div class="enroll-b">
<div class="enroll-t" style="background:url(<%= @competition.identifier == 'gcc-dev-2018' ? '/images/educoder/competition/dev.jpg' : '/images/educoder/competition/anon.jpg' %>) no-repeat top center;">
<div class="educontent">
<% if @competition.competition_staffs.sum(:minimum) > 1 %>
<% if @minimum_staff > 1 %>
<p class="clearfix edu-txt-right mb30">
<% unless User.current.logged? %>
<%= link_to "创建战队", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %>
@ -59,7 +59,7 @@
<div class="educontent" style="width: 934px;">
<% if @is_enroll.present? %>
<div class="pb30">
<% if @competition.competition_staffs.sum(:maximum) > 1 %>
<% if @maximum_staff > 1 %>
<!--战队报名显示-->
<div class="clearfix mt30 pr88">
<% @is_enroll.each do |team| %>
@ -117,7 +117,7 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mb5" onclick="search_enroll_team();">搜索</a>
<span class="fl mb5 ml10 pr5 none">战队数:<span id="search_teams_count" class="color-orange"></span>个</span>
<span class="fl mb5 ml10 pr5 none">成员数:<span id="team_members_count" class="color-orange"></span>个</span>
<span class="fr mb5 pr5"><%= @competition.max_num > 1 ? "战队总数" : "报名人数" %><span class="color-orange"><%= @team_count %></span>个</span>
<span class="fr mb5 pr5"><%= @maximum_staff > 1 ? "战队总数" : "报名人数" %><span class="color-orange"><%= @team_count %></span>个</span>
<div class="cl"></div>
<%= render :partial => "competitions/team_list" %>
<% else %>

Loading…
Cancel
Save