diff --git a/.ipynb_checkpoints/未命名-checkpoint.ipynb b/.ipynb_checkpoints/未命名-checkpoint.ipynb new file mode 100644 index 000000000..2fd64429b --- /dev/null +++ b/.ipynb_checkpoints/未命名-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/.ipynb_checkpoints/未命名1-checkpoint.ipynb b/.ipynb_checkpoints/未命名1-checkpoint.ipynb new file mode 100644 index 000000000..2fd64429b --- /dev/null +++ b/.ipynb_checkpoints/未命名1-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 9077192cf..0b85e3b31 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -186,6 +186,12 @@ class ShixunsController < ApplicationController #@fans_count = owner.fan_count #@followed_count = owner.follow_count @user_own_shixuns = owner.shixuns.published.count + ## 云上实验室过滤 + if current_laboratory.main_site? + @relate_subject = @shixun.subjects.visible.unhidden.uniq.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{current_laboratory.id}") + else + @relate_subject = @shixun.subjects.visible.unhidden.uniq.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id }) + end end # 排行榜 diff --git a/app/views/shixuns/_right.json.jbuilder b/app/views/shixuns/_right.json.jbuilder index e6f839aa5..f42633d86 100644 --- a/app/views/shixuns/_right.json.jbuilder +++ b/app/views/shixuns/_right.json.jbuilder @@ -5,7 +5,7 @@ end # 相关路径 json.paths do - json.partial! 'subjects/subject', locals: {subjects: shixun.relation_path} + json.partial! 'subjects/subject', locals: {subjects: @relate_subject} end # 推荐实训