p31729568 5 years ago
parent d7ce826e56
commit 4ccde9d71c

@ -26,10 +26,11 @@ class CompetitionTeamsController < ApplicationController
.where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
.group('shixun_id').count
# todo使用新版course_members
course_ids = Course.joins('join members on members.course_id = courses.id')
.joins('join member_roles on member_roles.member_id = members.id and member_roles.role_id in (3,7,9)')
.where(members: { user_id: @team_user_ids }).pluck(:id)
courses = Course.where(id: course_ids).joins(:shixun_homework_commons)
courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()')
@courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count')
.group('courses.id').order('shixun_homework_count desc')

@ -82,7 +82,9 @@
<tr>
<td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td>
<td width="40%" class="edu-txt-left">
<%= link_to course_path(course), target: '_blank' do %>
<span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span>
<% end %>
</td>
<td width="10%"><%= course.members_count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>

@ -46,7 +46,7 @@
<a href="<%= charts_competition_path(@competition) %>" >排行榜</a>
</li>
<% when '报名' %>
<li class="<%= params[:action] == 'enroll' || params[:action] == 'show' ? 'active' : '' %>">
<li class="<%= params[:action] == 'enroll' || (params[:controller] == 'competition_teams' && params[:action] == 'show') ? 'active' : '' %>">
<a href="<%= enroll_competition_path(@competition) %>">报名</a>
</li>
<% else %>

Loading…
Cancel
Save