このコミットが含まれているのは:
@@ -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
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする