Skip to content

Instantly share code, notes, and snippets.

@alienxp03
Created December 18, 2015 09:22
Show Gist options
  • Save alienxp03/e75085a5f66ed3415a8f to your computer and use it in GitHub Desktop.
Save alienxp03/e75085a5f66ed3415a8f to your computer and use it in GitHub Desktop.
result = {}
slips.each do |k,v|
key = k.split('_').last
data = {}
data[:number_transactions] = v[:transactions].count
data[:shop] = Hash[*shops.flatten][v[:shop]]
data[:total_amount] = 0
transactions.select{|transaction| v[:transactions].include? transaction[:id] }.each do |transaction|
transaction[:payout] ? data[:total_amount] += transaction[:amount] : data[:total_amount] -= transaction[:amount]
end
result[key.to_i] = data
end
puts results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment