dev_SaaS
caishi 6 years ago
commit 34d4ed390c

@ -321,9 +321,9 @@ class ShixunsController < ApplicationController
@search_name = "#{sub.name} / #{tag.name}"
end
shixun_id = ShixunTagRepertoire.where(:tag_repertoire_id => tag).map(&:shixun_id)
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text]).where(:id => shixun_id, :hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:id => shixun_id, :hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
else
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text]).where(:hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
@shixuns = Shixun.select([:id, :name, :user_id, :challenges_count, :visits, :status, :myshixuns_count, :trainee, :use_scope, :identifier, :image_text, :averge_star]).where(:hidden => 0).includes(:challenges, :schools, :shixun_members, :users).order("status = 2 desc, publish_time asc")
end
# # 依据tag和语言推荐实训如果tag不够则依据语言推荐语言不够则取系统的三个
# @recommend_shixuns = Shixun.find_by_sql("select challenge_id from challenge_tags where name like

@ -39,6 +39,10 @@ class Subject < ActiveRecord::Base
count
end
def member_count
self.shixuns.map(&:myshixuns_count).sum
end
def subject_shixuns
count = 0
self.stage_shixuns.each do |stage_shixun|

Loading…
Cancel
Save