From b1c0c1926567349b08ea93179ac3ac9007142b99 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 7 Mar 2019 10:59:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E6=88=B7=E9=A6=96=E9=A1=B5=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 2 +- app/models/shixun.rb | 2 +- app/views/shixuns/_shixun_item.html.erb | 77 ----------------------- app/views/subjects/_subject_item.html.erb | 2 - 4 files changed, 2 insertions(+), 81 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 52dc4eb5..a1e7299a 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -50,7 +50,7 @@ class WelcomeController < ApplicationController @rep_list << {rep_id: rep.id, rep_name: rep.name, sub_rep_list: sub_rep_list} end @shixuns = Shixun.select([:id, :user_id, :homepage_show, :identifier, :status, :name, :challenges_count, :myshixuns_count, :use_scope, - :trainee, :averge_star]).where(homepage_show: 1).includes(:tag_repertoires, :challenges).order("myshixuns_count desc").limit(8) + :trainee, :averge_star]).where(homepage_show: 1).includes(:tag_repertoires).order("myshixuns_count desc").limit(8) @subjects = Subject.where(homepage_show: 1).includes(:shixuns).limit(8) @tea_users = User.where(homepage_teacher: 1).includes(:user_extensions).limit(10).order("experience desc") @stu_users = User.includes(:user_extensions).where(user_extensions: {identity: 1}).limit(10).order("experience desc") diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 1bd7805c..0a7fff62 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -49,7 +49,7 @@ class Shixun < ActiveRecord::Base has_many :schools, :through => :shixun_schools has_many :exercise_shixun_challenges, :dependent => :destroy has_many :exercise_bank_shixun_challenges, :dependent => :destroy - has_many :tag_repertoires, :through => :shixun_tag_repertoires, :order => "tag_repertoires.name ASC" + has_many :tag_repertoires, :through => :shixun_tag_repertoires has_many :shixun_tag_repertoires, :dependent => :destroy diff --git a/app/views/shixuns/_shixun_item.html.erb b/app/views/shixuns/_shixun_item.html.erb index 3613ce4f..40420a8b 100644 --- a/app/views/shixuns/_shixun_item.html.erb +++ b/app/views/shixuns/_shixun_item.html.erb @@ -28,11 +28,6 @@ <%= shixun.challenges_count %> <% end %> - <% if shixun.shixun_score > 0 %> - - <%= shixun.shixun_score %> - - <% end %> <% if shixun.myshixuns_count > 0 %> <%= shixun.myshixuns_count %> @@ -66,75 +61,3 @@ }); }) - - - -<% if false %> - <% result = User.current.is_certification_teacher || User.current.admin? %> - <% shixuns.each do |shixun| %> -
- <% if shixun.tag_repertoires.first.present? %> -
<%= shixun.tag_repertoires.first.try(:name) %>
- <% end %> - <% unless result %> -
- -

暂未公开

-
- <% end %> - " class="square-img" target="_blank"> - <%= image_tag(url_to_avatar(shixun)) %> - -
-

- " class="justify color-grey-name" title="<%= shixun.name %>" target="_blank"><%= shixun.name %> -

- - -

<%= shixun.shixun_preference %>分

- -

- <% if shixun.challenges_count > 0 %> - - <%= shixun.challenges_count %> - - <% end %> - <% if shixun.shixun_score > 0 %> - - <%= shixun.shixun_score %> - - <% end %> - <% if shixun.myshixuns.count > 0 %> - - <%= shixun.myshixuns.count %> - - <% end %> - <%= shixun.shixun_level %> -

-
-
- <% end %> - - -<% end %> diff --git a/app/views/subjects/_subject_item.html.erb b/app/views/subjects/_subject_item.html.erb index db2c48bd..ac08c8a6 100644 --- a/app/views/subjects/_subject_item.html.erb +++ b/app/views/subjects/_subject_item.html.erb @@ -20,8 +20,6 @@ <%= subject.stages_count %> <% end %> - - <% if subject.member_count > 0 %> <%= subject.member_count %> <% end %>