このコミットが含まれているのは:
2026-10-09 20:27:51 +09:00
コミット 08f3b6d716
+12 -5
ファイルの表示
@@ -3,11 +3,11 @@ class WikiPagesController < ApplicationController
def index
# 互換性のための化石リソース
# TODO: ヘルプおよびタグ・グループ追加後に,
# TODO: タグ説明とヘルプ、タグ・グループから取得する作りに変更する.
#
# TODO: ヘルプ追加後にヘルプからも取得する作りに変更する.
title = params[:title].to_s.strip
descriptions = TagDescription.where(language_code: 'ja')
descriptions =
TagDescription.where(language_code: 'ja')
.includes(tag: :tag_names)
pages = unmigrated_wiki_pages.includes(tag_name: :tag)
@@ -16,10 +16,12 @@ class WikiPagesController < ApplicationController
descriptions = descriptions.joins(tag: :tag_names)
.where(tag_names: { language_code: 'ja', primary_flg: true })
.where('tag_names.name LIKE ?', pattern).limit(20)
tag_groups = TagGroup.where("CONCAT('タググループ:', name) LIKE ?", pattern).limit(20)
pages = pages.where('tag_names.name LIKE ?', pattern).limit(20)
end
json = descriptions.map { |description| WikiPageRepr.tag_description(description) }
json.concat(tag_groups.map { |tag_gorup| WikiPageRepr.tag_group(tag_group) })
json.concat(WikiPageRepr.base(pages))
json = json.first(20) if title.present?
render json:
@@ -271,7 +273,12 @@ class WikiPagesController < ApplicationController
def unmigrated_wiki_pages
descriptions = TagDescription.where(language_code: 'ja')
WikiPage.joins(:tag_name).where.not(id: descriptions.select(:id))
tag_groups = TagGroup.all
WikiPage
.joins(:tag_name)
.where.not(id: descriptions.select(:id))
.where.not(id: tag_groups.select(:id))
.where('tag_names.tag_id IS NULL OR tag_names.tag_id NOT IN (?)',
descriptions.select(:tag_id))
end