From 001a2e69ed49adfc6181a14fd78ab430b491c038 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sun, 17 Nov 2019 14:01:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=80=E5=B1=9E=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ipynb_checkpoints/未命名-checkpoint.ipynb | 6 ++++++ .ipynb_checkpoints/未命名1-checkpoint.ipynb | 6 ++++++ app/controllers/shixuns_controller.rb | 6 ++++++ app/views/shixuns/_right.json.jbuilder | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .ipynb_checkpoints/未命名-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/未命名1-checkpoint.ipynb 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 # 推荐实训