p31729568 5 years ago
parent 374d91449c
commit 2bd7ebdb2c

@ -17,7 +17,7 @@ class CompetitionTeamsController < ApplicationController
@team_user_ids = @team.team_members.pluck(:user_id)
shixuns = Shixun.where(user_id: @team_user_ids, status: 2)
shixuns = Shixun.where(user_id: @team_user_ids, status: 2).where('shixuns.created_at > ?', Time.parse('2018-06-01'))
shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2')
shixuns = shixuns.joins('left join myshixuns on myshixuns.shixun_id = shixuns.id and exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)')
shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count')
@ -27,12 +27,13 @@ class CompetitionTeamsController < ApplicationController
.group('shixun_id').count
# todo使用新版course_members
course_ids = Course.joins('join members on members.course_id = courses.id')
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.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).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')
.group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0')
@course_myshixun_map = Myshixun.joins(student_works: :homework_common)
.where(homework_commons: { course_id: @courses.map(&:id) })

@ -11,8 +11,8 @@
<th width="10%">创建者</th>
<th width="40%" class="edu-txt-left">名称</th>
<th width="10%">学习人数</th>
<th width="15%">fork版的学习人数</th>
<th width="10%">有效作品数</th>
<th width="15%" data-tip-down="fork该实训产生的新实训学习总人数">fork版的学习人数</th>
<th width="10%" data-tip-down="至少完成了1个关卡">有效作品数</th>
<th width="15%">经验值</th>
</tr>
</thead>
@ -38,7 +38,7 @@
</td>
<td width="10%"><%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %></td>
<td width="15%"><%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %></td>
<th width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></th>
<td width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></td>
<td width="15%">--</td>
</tr>
<% end %>
@ -65,7 +65,7 @@
<th width="40%" class="edu-txt-left">名称</th>
<th width="10%">学生数量</th>
<th width="15%">发布的实训作业数量</th>
<th width="10%">有效作品数</th>
<th width="10%" data-tip-down="至少完成了1个关卡">有效作品数</th>
<th width="15%">经验值</th>
</tr>
</thead>
@ -88,7 +88,7 @@
</td>
<td width="10%"><%= course.members_count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>
<th width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></th>
<td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td>
<td width="15%">--</td>
</tr>
<% end %>

@ -5,7 +5,15 @@
<% @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 => "用户头像" %>
<% if @competition.identifier == 'gcc-course-2019' %>
<%= link_to competition_team_path(id: team.id) do %>
<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>
<% end %>
<% else %>
<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>
<% end %>
<% if @maximum_staff > 1 %>
<span class="fl mr40 mt10" style="width: 270px;">
<% team.teachers.each do |teacher| %>

@ -97,7 +97,7 @@
<a href="javascript:void(0)" class="font-16 color-grey-c fl mt12" onclick="delete_confirm_box('<%= exit_team_competition_team_path(team) %>', '是否确认退出战队')">退出</a>
<% end %>
<% end %>
<a href="javascript:void(0)" class="enrollOperation">进入大赛</a>
<%= link_to '进入大赛', competition_path(@competition), class: 'enrollOperation' %>
<% if @competition.identifier == 'gcc-course-2019' %>
<%= link_to '战队详情', competition_team_path(id: team.id), class: 'enrollOperation' %>
<% end %>

@ -864,7 +864,7 @@ table.tBodyScroll thead th{
height: 20px;
line-height: 19px!important;
margin-top: 18px;
margin-left: 15px;
margin-left: 10px;
}
/*弹框*/
.c-l-box{background: rgba(139,163,183,0.08);height: 226px;overflow-y: auto;width: 100%;padding: 20px 20px 0px 20px;box-sizing: border-box;}

Loading…
Cancel
Save