From ed76941a50bf53205d61d808770a49d0f48f3397 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 5 Jul 2019 14:58:04 +0800 Subject: [PATCH 1/4] =?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/services/users_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 6ab6d3f6..d60de29c 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -360,7 +360,7 @@ class UsersService g = Gitlab.client g.edit_user(@current_user.gid, :password => params[:new_password]) rescue Exception => e - logger.error "change users password failed! ===> #{e}" + Rails.logger.error "change users password failed! ===> #{e}" end end end From 2bd7ebdb2cad727f22f26bba3cbf1ba330e53161 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 5 Jul 2019 15:07:31 +0800 Subject: [PATCH 2/4] 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;} From 592161700bdeb0f77940b6c4f43e99860c449cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 5 Jul 2019 15:33:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?mdwatch=E5=8F=82=E6=95=B0=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/libraries/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index b3ed4721..a813e4b7 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -66,7 +66,7 @@ //你的lib目录的路径,我这边用JSP做测试的 path: "/editormd/lib/", tex: true, - watch:false, + watch:true, toolbarIcons: function () { // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. From d17759496499127a2fefd17a6fff7051a4aa30ff Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 5 Jul 2019 15:35:30 +0800 Subject: [PATCH 4/4] fix --- .../competition_teams_controller.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 14747821..c0bde5e4 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -19,12 +19,16 @@ class CompetitionTeamsController < ApplicationController 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') @shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator) - @myshixun_count_map = Myshixun.where(shixun_id: @shixuns.map(&:id)) - .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') - .group('shixun_id').count + + shixun_ids = @shixuns.map(&:id) + @myshixun_count_map = get_valid_myshixun_count(shixun_ids) + # forked shixun valid myshixun count + forked_shixun_map = Shixun.where(status: 2, fork_from: shixun_ids).select('id, fork_from') + forked_shixun_map = forked_shixun_map.each_with_object({}) { |sx, obj| obj[sx.id] = sx.fork_from } + forked_myshixun_count_map = get_valid_myshixun_count(forked_shixun_map.keys) + forked_myshixun_count_map.each { |k, v| @myshixun_count_map[forked_shixun_map[k]] += v } # todo:使用新版course_members course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) @@ -323,4 +327,10 @@ class CompetitionTeamsController < ApplicationController true end + + def get_valid_myshixun_count(ids) + Myshixun.where(shixun_id: ids) + .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') + .group('shixun_id').count + end end