Skip to content

Commit

Permalink
Merge pull request #99 from ontoportal-lirmm/fix/google-analytics-v4
Browse files Browse the repository at this point in the history
Fix: an issue with the GA4 Analytics migration
  • Loading branch information
syphax-bouazzouni authored Oct 12, 2023
2 parents 087c28b + f887877 commit 03710bf
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 03710bf

Please sign in to comment.