このコミットが含まれているのは:
2026-08-05 12:43:33 +09:00
コミット b5b5391c8e
4個のファイルの変更39行の追加36行の削除
+19 -6
ファイルの表示
@@ -137,18 +137,31 @@ class Post < ApplicationRecord
end
end
def self.tag_snapshot_literal tag
sections = tag.fetch('sections', []).map do |sec|
begin_ms = sec.fetch('begin_ms')
end_ms = sec['end_ms']
"[#{ Post.ms_to_time(begin_ms) }-#{ end_ms ? Post.ms_to_time(end_ms) : '' }]"
end
"#{ tag.fetch('name') }#{ sections.join }"
end
def snapshot_tags_json
post_tags
.kept
.joins(tag: :tag_name)
.includes(:sections, tag: :tag_name)
.order('tag_names.name')
.order('tags.id')
.map do |pt|
{ id: pt.tag.id,
version_no: pt.tag.version_no,
name: pt.tag.name,
category: pt.tag.category,
sections: pt.sections.map { { begin_ms: _1.begin_ms, end_ms: _1.end_ms } } }
{ 'id' => pt.tag.id,
'version_no' => pt.tag.version_no,
'name' => pt.tag.name,
'category' => pt.tag.category,
'sections' => pt.sections.sort_by(&:begin_ms).map {
{ 'begin_ms' => _1.begin_ms, 'end_ms' => _1.end_ms }
} }
end
end