From 2bd7ebdb2cad727f22f26bba3cbf1ba330e53161 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 5 Jul 2019 15:07:31 +0800 Subject: [PATCH] fix --- app/controllers/competition_teams_controller.rb | 7 ++++--- app/views/competition_teams/show.html.erb | 10 +++++----- app/views/competitions/_qg_second_opensource.html.erb | 4 ++-- app/views/competitions/_team_list.html.erb | 10 +++++++++- app/views/competitions/enroll.html.erb | 2 +- public/stylesheets/educoder/edu-all.css | 2 +- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 5b46986a..14747821 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -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) }) diff --git a/app/views/competition_teams/show.html.erb b/app/views/competition_teams/show.html.erb index bc176c1e..129fa32a 100644 --- a/app/views/competition_teams/show.html.erb +++ b/app/views/competition_teams/show.html.erb @@ -11,8 +11,8 @@ 创建者 名称 学习人数 - fork版的学习人数 - 有效作品数 + fork版的学习人数 + 有效作品数 经验值 @@ -38,7 +38,7 @@ <%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %> <%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %> - <%= @myshixun_count_map.fetch(shixun.id, '--') %> + <%= @myshixun_count_map.fetch(shixun.id, '--') %> -- <% end %> @@ -65,7 +65,7 @@ 名称 学生数量 发布的实训作业数量 - 有效作品数 + 有效作品数 经验值 @@ -88,7 +88,7 @@ <%= course.members_count %> <%= course['shixun_homework_count'].presence || '--' %> - <%= @course_myshixun_map.fetch(course.id, '--') %> + <%= @course_myshixun_map.fetch(course.id, '--') %> -- <% end %> diff --git a/app/views/competitions/_qg_second_opensource.html.erb b/app/views/competitions/_qg_second_opensource.html.erb index ec05b3c5..b7e878e9 100644 --- a/app/views/competitions/_qg_second_opensource.html.erb +++ b/app/views/competitions/_qg_second_opensource.html.erb @@ -15,11 +15,11 @@

<%= first_section.try(:name) %> - <%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %> ~ <%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %> + <%= first_section.start_time.try(:strftime, '%Y年%m月%d日') %>~<%= first_section.end_time.try(:strftime, '%Y年%m月%d日') %> <%= second_section.try(:name) %> - <%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %> ~ <%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %> + <%= second_section.try(:start_time).try(:strftime, '%Y年%m月%d日') %>~<%= second_section.try(:end_time).try(:strftime, '%Y年%m月%d日') %>

  • diff --git a/app/views/competitions/_team_list.html.erb b/app/views/competitions/_team_list.html.erb index 5e75b3a4..ba445c7b 100644 --- a/app/views/competitions/_team_list.html.erb +++ b/app/views/competitions/_team_list.html.erb @@ -5,7 +5,15 @@ <% @teams.each do |team| %>
  • <%= 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 => "用户头像" %> - <%= @maximum_staff > 1 ? team.name : team.user.show_name %> + + <% if @competition.identifier == 'gcc-course-2019' %> + <%= link_to competition_team_path(id: team.id) do %> + <%= @maximum_staff > 1 ? team.name : team.user.show_name %> + <% end %> + <% else %> + <%= @maximum_staff > 1 ? team.name : team.user.show_name %> + <% end %> + <% if @maximum_staff > 1 %> <% team.teachers.each do |teacher| %> diff --git a/app/views/competitions/enroll.html.erb b/app/views/competitions/enroll.html.erb index bf4ddc05..69bedd2f 100644 --- a/app/views/competitions/enroll.html.erb +++ b/app/views/competitions/enroll.html.erb @@ -97,7 +97,7 @@ 退出 <% end %> <% end %> - 进入大赛 + <%= link_to '进入大赛', competition_path(@competition), class: 'enrollOperation' %> <% if @competition.identifier == 'gcc-course-2019' %> <%= link_to '战队详情', competition_team_path(id: team.id), class: 'enrollOperation' %> <% end %> diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 443064c4..19ab3793 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -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;}