实训页面的所属课程调整

dev_cs
cxt 5 years ago
parent 98e44d8950
commit ff03e74928

@ -247,7 +247,7 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
User.current = User.find 8686
User.current = User.find 1
end

@ -56,11 +56,6 @@ module ApplicationHelper
end
# 相关推荐
def relation_path(shixun)
shixun.subjects.where(hidden: 0).limit(2)
end
# shixun开启挑战对应的行为名及url
def task_operation_url current_myshixun, shixun
if current_myshixun.blank?

@ -280,6 +280,11 @@ class Shixun < ApplicationRecord
self.mirror_name.include?('JavaWeb') || self.mirror_name.include?('PHP') && self.mirror_name.include?('Mysql') || self.mirror_name.include?('Web')
end
# 所属实践课程
def relation_path
subjects.where(hidden: 0).uniq
end
private
def send_tiding

@ -3,14 +3,14 @@ json.creator do
json.partial! 'users/user', locals: { user: shixun.owner }
end
# 推荐实训
json.recommands do
json.partial! 'shap_shixun', locals: { shixuns: recommend_shixun(shixun) }
end
# 相关路径
json.paths do
json.partial! 'subjects/subject', locals: {subjects: relation_path(shixun)}
json.partial! 'subjects/subject', locals: {subjects: shixun.relation_path}
end
# 推荐实训
json.recommands do
json.partial! 'shap_shixun', locals: { shixuns: shixun.relation_path.size > 0 ? recommend_shixun(shixun) : [] }
end
# 技能标签

Loading…
Cancel
Save