Add known_glitches to appearances JSON

This commit is contained in:
Emi Matchu 2023-11-11 07:21:13 -08:00
parent 010f64264f
commit 6c31094c2d

View file

@ -97,7 +97,7 @@ class SwfAsset < ApplicationRecord
def as_json(options={})
super({
only: [:id],
only: [:id, :known_glitches],
methods: [:zone, :restricted_zones, :urls]
}.merge(options))
end
@ -110,6 +110,17 @@ class SwfAsset < ApplicationRecord
}
end
def known_glitches
self[:known_glitches].split(',')
end
def known_glitches=(new_known_glitches)
if new_known_glitches.is_a? Array
new_known_glitches = new_known_glitches.join(',')
end
self[:known_glitches] = new_known_glitches
end
def restricted_zone_ids
[].tap do |ids|
zones_restrict.chars.each_with_index do |bit, index|