Skip to content

Commit

Permalink
CV2-4665: fix rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Jul 23, 2024
1 parent 4dce043 commit efc2ad2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/tasks/migrate/20240703070839_add_language_to_fact_check.rake
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ namespace :check do
pm_fc = {}
items.each{ |i| pm_fc[i['id']] = i['fc_id'] }
fc_fields = {}
# Add rating (depend on status cached field)
ProjectMedia.where(id: pm_fc.keys).find_each do |pm|
print '.'
tags = pm.tags_as_sentence.split(',')
fc_fields[pm_fc[pm.id]] = { rating: pm.status, tags: tags }
end
# Collect report designer
Dynamic.where(annotation_type: 'report_design', annotated_type: 'ProjectMedia', annotated_id: pm_fc.keys).find_each do |rd|
print '.'
# Get report status and publisher id
state = rd.data['state']
publisher_id = state == 'published' ? rd.annotator_id : nil
fc_fields[pm_fc[rd.annotated_id]] = { publisher_id: publisher_id, report_status: state }
end
# Add rating (depend on status cached field)
ProjectMedia.where(id: pm_fc.keys).find_each do |pm|
print '.'
tags = pm.tags_as_sentence.split(',')
fc_fields[pm_fc[pm.id]].merge!({ rating: pm.status, tags: tags })
fc_fields[pm_fc[rd.annotated_id]].merge!({ publisher_id: publisher_id, report_status: state })
end
fc_items = []
FactCheck.where(id: pm_fc.values).find_each do |fc|
Expand Down

0 comments on commit efc2ad2

Please sign in to comment.