Skip to content

Commit

Permalink
fixed bug in ontology analytics population process
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Mar 2, 2024
1 parent 556d711 commit 52c43bd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/ncbo_cron/ontology_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ def merge_and_fill_missing_data(ga4_data)
ua_ga4_intersecting_month = Date.parse(GA4_START_DATE).month.to_s

# add up hits for June of 2023 (the only intersecting month between UA and GA4)
ua_data.each do |acronym, _|
if ga4_data.has_key?(acronym)
if ga4_data[acronym][ua_ga4_intersecting_year].has_key?(ua_ga4_intersecting_month)
ua_data[acronym][ua_ga4_intersecting_year][ua_ga4_intersecting_month] +=
ga4_data[acronym][ua_ga4_intersecting_year][ua_ga4_intersecting_month]
# delete data for June of 2023 from ga4_data to avoid overwriting when merging
ga4_data[acronym][ua_ga4_intersecting_year].delete(ua_ga4_intersecting_month)
end
end
ua_data.each do |acronym|
next unless ga4_data.key?(acronym)
next unless ga4_data[acronym].key?(ua_ga4_intersecting_year)
next unless ga4_data[acronym][ua_ga4_intersecting_year].key?(ua_ga4_intersecting_month)

ua_data[acronym][ua_ga4_intersecting_year][ua_ga4_intersecting_month] +=
ga4_data[acronym][ua_ga4_intersecting_year][ua_ga4_intersecting_month]
# delete data for June of 2023 from ga4_data to avoid overwriting when merging
ga4_data[acronym][ua_ga4_intersecting_year].delete(ua_ga4_intersecting_month)
end
end

Expand Down

0 comments on commit 52c43bd

Please sign in to comment.