Skip to content
Snippets Groups Projects
Commit 7a5c41da authored by bfs15's avatar bfs15
Browse files

added default attachment location to LO serializer

parent 9cd70996
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,10 @@ class LearningObject < ApplicationRecord
nil
end
def default_attachment_location
object_type.try(:name) == ("Vídeo" || "Áudio") ? default_attachment.try(:retrieve_cache_link) : default_attachment.try(:retrieve_url)
end
def default_thumbnail
return thumbnail unless thumbnail.blank?
return nil if attachments.blank?
......@@ -125,10 +129,6 @@ class LearningObject < ApplicationRecord
default_attachment.retrieve_cache_link
end
def download_link
object_type.try(:name) == ("Vídeo" || "Áudio") ? default_attachment.try(:retrieve_cache_link) : default_attachment.try(:retrieve_url)
end
## score methods
def normalized_collected
max = CollectionItem.where(collectionable_type: 'LearningObject').group(:collectionable_id).order('count_all DESC').count
......
......@@ -37,6 +37,7 @@ class LearningObjectSerializer < ActiveModel::Serializer
:thumbnail,
:object_type,
:language,
:default_attachment_location,
:default_attachment_id,
:default_mime_type,
:score,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment