Skip to content

Commit

Permalink
CV2-6038: apply PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Feb 10, 2025
1 parent 8980b8d commit 54a73cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/models/concerns/project_media_getters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ def fact_check
self.claim_description&.fact_check
end

def explainers_title
# Get the title for all explainer assinged to the item
titles = Explainer.joins(:explainer_items).where('explainer_items.project_media_id = ?', self.id).map(&:title).join(' ')
def explainers_titles
# Get the title for all explainer assigned to the item
titles = Explainer.joins(:explainer_items).where('explainer_items.project_media_id = ?', self.id).map(&:title).join("\n")
titles.blank? ? nil : titles
end
end
2 changes: 1 addition & 1 deletion app/models/explainer_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update_elasticsearch_data
pm.update_columns(updated_at: updated_at)
data = { updated_at: updated_at.utc }
data['explainer_title'] = {
method: "explainers_title",
method: "explainers_titles",
klass: pm.class.name,
id: pm.id,
default: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ namespace :check do
next if skip_pmids.include?(raw.project_media_id)
pm = raw.project_media
doc_id = Base64.encode64("ProjectMedia/#{pm.id}")
explainers_title = pm.explainers_title
fields = { 'explainer_title' => pm.explainers_title }
fields = { 'explainer_title' => pm.explainers_titles }
es_body << { update: { _index: index_alias, _id: doc_id, retry_on_conflict: 3, data: { doc: fields } } }
skip_pmids << pm.id
end
Expand Down

0 comments on commit 54a73cf

Please sign in to comment.