このコミットが含まれているのは:
2026-09-27 23:55:19 +09:00
コミット 749d49327e
30個のファイルの変更、258行の追加、188行の削除
+10 -8
ファイルの表示
@@ -126,13 +126,14 @@ class Post < ApplicationRecord
super(options).merge(thumbnail: nil)
end
def snapshot_tag_names
def snapshot_tag_names language_code = 'ja'
post_tags
.joins(tag: :tag_name)
.includes(:sections, tag: :tag_name)
.joins(tag: :tag_names)
.where(tag_names: { language_code:, primary_flg: true })
.includes(:sections, tag: :tag_names)
.order('tag_names.name')
.map do |post_tag|
name = post_tag.tag.tag_name.name
name = post_tag.tag.name(language_code)
sections = post_tag.sections.sort_by(&:begin_ms)
next name if sections.empty?
@@ -152,16 +153,17 @@ class Post < ApplicationRecord
"#{ tag.fetch('name') }#{ sections.join }"
end
def snapshot_tags_json
def snapshot_tags_json language_code = 'ja'
tag_snapshots =
post_tags
.joins(tag: :tag_name)
.includes(:sections, tag: :tag_name)
.joins(tag: :tag_names)
.where(tag_names: { language_code:, primary_flg: true })
.includes(:sections, tag: :tag_names)
.order('tags.id')
.map { |pt|
{ 'tag_id' => pt.tag.id,
'version_no' => pt.tag.version_no,
'name' => pt.tag.name,
'name' => pt.tag.name(language_code),
'category' => pt.tag.category,
'sections' => pt.sections.sort_by(&:begin_ms).map {
{ 'begin_ms' => _1.begin_ms, 'end_ms' => _1.end_ms }