Created
June 3, 2016 17:03
-
-
Save mib32/cfbbeadd6e08a66cc03e47a5b495ca87 to your computer and use it in GitHub Desktop.
function of double array calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stats_source.clicks_statistic_by(start_date..end_date, :device).tap {|arr| arr.map{|row| row[:max] = arr.max{|a, b| a[:clicks_amount] <=> b[:clicks_amount]}[:clicks_amount]}}.map{|row| row[:clicks_percentage] = 100 * row[:clicks_amount] / row[:max]; row}.each do |row| | |
print row | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment