0
Well I created a method to group all one user’s commits per month into one Hash:
def calculate_month_ranking(commits)
rank = Hash.new(Hash.new(0))
commits.each do |commit_yml|
commit = YAML.load commit_yml.data
commit[:commits].each do |local_commit|
time = Time.parse(local_commit[:timestamp])
month = "#{time.month}/#{time.year}"
rank[month][commit[:user_name]]+= 1
binding.pry # para debug
end
end
rank
end
The result is that when recovering the data by month the data appears, but the variable rank
is empty as you can see in the debug below
[1] pry(main)> rank[month]
=> {"user1"=>4, "user2"=>1}
[2] pry(main)> rank
=> {}