Created
November 9, 2012 16:22
-
-
Save servidorv/4046634 to your computer and use it in GitHub Desktop.
compact key
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
def get_loyalty(date_range, page_id) | |
loyalty_users = {} | |
date_range.each{|range| | |
loyalty_users.merge!([range[:month], range[:year]] => find_loyaltys(range[:month], range[:year], page_id)) | |
} | |
return loyalty_users | |
end | |
this comes out like | |
users_loyalty: { | |
[8, 2012]: [ ], | |
[9, 2012]: [ ], | |
[10, 2012]: [ | |
{ | |
_id: { | |
$oid: "509d2256844d8b1810000019" | |
}, | |
name: "Baso car", | |
category: "Automobiles and parts", | |
id: "276256145729599", | |
month: 10, | |
year: 2012, | |
page_id: "58128939954" | |
}, | |
i want it to be like | |
users_loyalty: { | |
[82012]: [ ], | |
[92012]: [ ], | |
[102012]: [ | |
{ | |
_id: { | |
$oid: "509d2256844d8b1810000019" | |
}, | |
name: "Baso car", | |
category: "Automobiles and parts", | |
id: "276256145729599", | |
month: 10, | |
year: 2012, | |
page_id: "58128939954" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment