From f97277cb284037c7c3f9a8cb542f19f5fc0a8238 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 10 Oct 2019 16:38:21 +0800 Subject: [PATCH] 1 --- app/models/mirror_repository.rb | 2 +- app/models/shixun.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb index e29b008ad..ddbc64e39 100644 --- a/app/models/mirror_repository.rb +++ b/app/models/mirror_repository.rb @@ -5,7 +5,7 @@ class MirrorRepository < ApplicationRecord - scope :published_mirror, -> { where(status: 1) } + scope :published_mirror, -> { where(status: [0,1]) } scope :published_main_mirror, -> { published_mirror.where(main_type: 1) } scope :published_small_mirror, -> { published_mirror.where(main_type: 0) } diff --git a/app/models/shixun.rb b/app/models/shixun.rb index da6853ac0..4912ea15a 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -129,7 +129,7 @@ class Shixun < ApplicationRecord end def main_mirror_id - mirror_repositories.where(main_type: 1).first.try(:id) || -1 + mirror_repositories.published_main_mirror.first.try(:id) || -1 end # 实训对应的镜像小类别名(已选)