Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: an issue with the GA4 Analytics migration #99

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/ontologies_linked_data/models/ontology.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ def self.analytics(year=nil, month=nil, acronyms=nil)
unless analytics.empty?
analytics.delete_if { |acronym, _| !acronyms.include? acronym } unless acronyms.nil?
analytics.values.each do |ont_analytics|
ont_analytics.delete_if { |key, _| key != year } unless year.nil?
ont_analytics.each { |_, val| val.delete_if { |key, __| key != month } } unless month.nil?
ont_analytics.delete_if { |key, _| key != year.to_s } unless year.nil?
ont_analytics.each { |_, val| val.delete_if { |key, __| key != month.to_s } } unless month.nil?
end
# sort results by the highest traffic values
analytics = Hash[analytics.sort_by {|_, v| v[year][month]}.reverse] if year && month
analytics = Hash[analytics.sort_by {|_, v| v[year.to_s][month.to_s]}.reverse] if year && month
end
analytics
end
Expand Down