このコミットが含まれているのは:
@@ -1,3 +1,5 @@
|
|||||||
|
require 'json'
|
||||||
|
|
||||||
class BackfillInitialMaterialVersions < ActiveRecord::Migration[8.0]
|
class BackfillInitialMaterialVersions < ActiveRecord::Migration[8.0]
|
||||||
class MigrationMaterial < ActiveRecord::Base
|
class MigrationMaterial < ActiveRecord::Base
|
||||||
self.table_name = 'materials'
|
self.table_name = 'materials'
|
||||||
@@ -143,7 +145,7 @@ class BackfillInitialMaterialVersions < ActiveRecord::Migration[8.0]
|
|||||||
file_content_type: blob.content_type,
|
file_content_type: blob.content_type,
|
||||||
file_byte_size: blob.byte_size,
|
file_byte_size: blob.byte_size,
|
||||||
file_checksum: blob.checksum,
|
file_checksum: blob.checksum,
|
||||||
file_sha256: blob.metadata['sha256']
|
file_sha256: blob_metadata(blob)['sha256']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -156,4 +158,14 @@ class BackfillInitialMaterialVersions < ActiveRecord::Migration[8.0]
|
|||||||
file_checksum: nil,
|
file_checksum: nil,
|
||||||
file_sha256: nil }
|
file_sha256: nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def blob_metadata blob
|
||||||
|
metadata = blob.metadata
|
||||||
|
return metadata if metadata.is_a?(Hash)
|
||||||
|
return { } if metadata.blank?
|
||||||
|
|
||||||
|
JSON.parse(metadata)
|
||||||
|
rescue JSON::ParserError
|
||||||
|
{ }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする