From 0b5e90467112f1ecb7f29ae38ce706ea99c44290 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Mon, 24 Feb 2020 11:20:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20200223021427_sync_subjectds_mobile.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20200223021427_sync_subjectds_mobile.rb b/db/migrate/20200223021427_sync_subjectds_mobile.rb index 1c2fb6c3e..fae6aaabb 100644 --- a/db/migrate/20200223021427_sync_subjectds_mobile.rb +++ b/db/migrate/20200223021427_sync_subjectds_mobile.rb @@ -1,7 +1,7 @@ class SyncSubjectdsMobile < ActiveRecord::Migration[5.2] def change SubDisciplineContainer.find_each do |sc| - subject.find(sc.container_id).update_column(:show_mobile => true) + Subject.find(sc.container_id).update_column(:show_mobile, true) end end end From b4a22f0dcc7a3fc5256c0d7433ddde877c5a03fa Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 25 Feb 2020 12:30:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/subject.rb | 1 + app/queries/weapps/subject_query.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/subject.rb b/app/models/subject.rb index 70f9700df..387e5adb1 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -41,6 +41,7 @@ class Subject < ApplicationRecord scope :published, lambda{where(status: 1)} scope :unhidden, lambda{where(hidden: 0)} scope :publiced, lambda{ where(public: 2) } + scope :show_moblied, lambda{ where(show_mobile: true) } after_create :send_tiding def send_tiding diff --git a/app/queries/weapps/subject_query.rb b/app/queries/weapps/subject_query.rb index 8bfe9e9a8..e2f5625e1 100644 --- a/app/queries/weapps/subject_query.rb +++ b/app/queries/weapps/subject_query.rb @@ -8,7 +8,7 @@ class Weapps::SubjectQuery < ApplicationQuery end def call - subjects = @current_laboratory.subjects.unhidden.publiced + subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied # 课程体系的过滤 if params[:sub_discipline_id].present?