Skip to content

Commit

Permalink
Setting initial value for last_request_date for feed clusters. (#2072)
Browse files Browse the repository at this point in the history
There was a change introduced in CV2-5331 that normalized how the `last_request_date` field for a shared feed cluster is calculated. But there is an issue: if the cluster doesn't have any request, no value is set. The fix needed here is to be sure that there is an initial value, which can be the same date as the last item that joined the cluster, when this item has no requests.

Fixes: CV2-5446.
  • Loading branch information
caiosba authored Oct 8, 2024
1 parent 5c38959 commit 11e20d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tasks/check_khousheh.rake
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ namespace :check do
updated_cluster_attributes[:channels] = (cluster.channels.to_a + pm.channel.to_h['others'].to_a + [pm.channel.to_h['main']]).uniq.compact_blank
updated_cluster_attributes[:media_count] = cluster.media_count + 1
updated_cluster_attributes[:requests_count] = cluster.requests_count + pm.requests_count
updated_cluster_attributes[:last_request_date] = (pm.tipline_requests.last&.created_at.to_i > cluster.last_request_date.to_i) ? pm.tipline_requests.last.created_at : cluster.last_request_date
updated_cluster_attributes[:last_request_date] = (pm.tipline_requests.last&.created_at.to_i > cluster.last_request_date.to_i) ? pm.tipline_requests.last.created_at : (cluster.last_request_date || Time.at(pm.last_seen))
updated_cluster_attributes[:fact_checks_count] = cluster.fact_checks_count
updated_cluster_attributes[:last_fact_check_date] = cluster.last_fact_check_date
unless pm_fc_mapping[pm.id].blank?
Expand Down

0 comments on commit 11e20d4

Please sign in to comment.