From 9b591f8fc02b05af858d26bf3e5daeb2933c115e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 22 Oct 2019 09:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/charts.html.erb | 2 ++ lib/tasks/competition_gcc_course_statistic.rake | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/competitions/charts.html.erb b/app/views/competitions/charts.html.erb index 37828fb1..86b20033 100644 --- a/app/views/competitions/charts.html.erb +++ b/app/views/competitions/charts.html.erb @@ -4,6 +4,8 @@
<% if @competition.identifier == "gcc-annotation-2018" %>
  • 开源标注正赛排行榜
  • + <% elsif @competition.identifier == "gcc-course-2019" %> +
  • 排行榜
  • <% else %> <% if @max_min_stage.count == 1 %>
  • 排行榜
  • diff --git a/lib/tasks/competition_gcc_course_statistic.rake b/lib/tasks/competition_gcc_course_statistic.rake index 192c2975..f212a365 100644 --- a/lib/tasks/competition_gcc_course_statistic.rake +++ b/lib/tasks/competition_gcc_course_statistic.rake @@ -17,7 +17,7 @@ namespace :competition do # =========== Shixun =========== 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.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) @@ -82,7 +82,7 @@ namespace :competition do .select('sum(compelete_status !=0 ) as finish, count(*) as total') .having('total != 0 and finish >= (total / 2)').to_sql 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("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)')