From faa2d99160c54f9ca8f0bc58d39675a46918d851 Mon Sep 17 00:00:00 2001 From: Type-kun Date: Mon, 19 Jun 2017 18:22:58 +0500 Subject: [PATCH] Fix #3174 --- app/logical/sources/site.rb | 4 +++- app/models/wiki_page.rb | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/logical/sources/site.rb b/app/logical/sources/site.rb index 4a9643779..50b233eb8 100644 --- a/app/logical/sources/site.rb +++ b/app/logical/sources/site.rb @@ -55,7 +55,9 @@ module Sources end end untranslated_tags.reject! {|x| x.blank?} - WikiPage.other_names_equal(untranslated_tags).map{|wiki_page| [wiki_page.title, wiki_page.category_name]} + wikis = WikiPage.title_in(untranslated_tags) + wikis += WikiPage.other_names_equal(untranslated_tags) + wikis.uniq.map{|wiki_page| [wiki_page.title, wiki_page.category_name]} end def to_h diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 76148e04e..77586c484 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -24,6 +24,10 @@ class WikiPage < ApplicationRecord where("title = ?", title.mb_chars.downcase.tr(" ", "_")) end + def title_in(titles) + where("title in (?)", titles.map{|x| x.mb_chars.downcase.tr(" ", "_")} ) + end + def active where("is_deleted = false") end