dev_aliyun
cxt 5 years ago
parent 8513370063
commit 9b591f8fc0

@ -4,6 +4,8 @@
<div class="inline"> <div class="inline">
<% if @competition.identifier == "gcc-annotation-2018" %> <% if @competition.identifier == "gcc-annotation-2018" %>
<li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">开源标注正赛排行榜</a></li> <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">开源标注正赛排行榜</a></li>
<% elsif @competition.identifier == "gcc-course-2019" %>
<li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li>
<% else %> <% else %>
<% if @max_min_stage.count == 1 %> <% if @max_min_stage.count == 1 %>
<li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li> <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li>

@ -17,7 +17,7 @@ namespace :competition do
# =========== Shixun =========== # =========== Shixun ===========
shixuns = Shixun.where(user_id: team_user_ids, status: 2) shixuns = Shixun.where(user_id: team_user_ids, status: 2)
.where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), competition.end_time) .where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), Time.now)
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 shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.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') 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')
shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator) shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator)
@ -82,7 +82,7 @@ namespace :competition do
.select('sum(compelete_status !=0 ) as finish, count(*) as total') .select('sum(compelete_status !=0 ) as finish, count(*) as total')
.having('total != 0 and finish >= (total / 2)').to_sql .having('total != 0 and finish >= (total / 2)').to_sql
course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01'))
.where('courses.created_at <= ?', competition.end_time) .where('courses.created_at <= ?', Time.now)
.where("(#{student_count_subquery}) >= 3") .where("(#{student_count_subquery}) >= 3")
.where("exists(select 1 from homework_commons hcs where hcs.course_id = courses.id and hcs.publish_time is not null and hcs.publish_time < NOW() and hcs.homework_type = 4 and exists(#{subquery}))") .where("exists(select 1 from homework_commons hcs where hcs.course_id = courses.id and hcs.publish_time is not null and hcs.publish_time < NOW() and hcs.homework_type = 4 and exists(#{subquery}))")
.joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)') .joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)')

Loading…
Cancel
Save