Skip to content

Instantly share code, notes, and snippets.

@jdkealy
Last active January 1, 2016 19:09
Show Gist options
  • Save jdkealy/8188504 to your computer and use it in GitHub Desktop.
Save jdkealy/8188504 to your computer and use it in GitHub Desktop.
#the query:
#"Show me all posts, group by post_comments_count"
#the raw data
[{:d=>11, :v=>1, :last_id=>"527bcc423004f951123b7c1d"}, {:d=>9, :v=>1, :last_id=>"524afa4d30040d96248b828d"}, {:d=>5, :v=>1, :last_id=>"52bc9aec300441a506054092"}, {:d=>4, :v=>1, :last_id=>"527bcc453004f951123b7c80"}, {:d=>3, :v=>1, :last_id=>"520a30b33004882ce9feece7"}, {:d=>2, :v=>2, :last_id=>"52bc9aed300441a50605409b"}, {:d=>1, :v=>5, :last_id=>"524afa4e30040d96248b82ae"}, {:d=>0, :v=>15, :last_id=>"52bc9aee300441a506054100"}]
#the meaning
#" i have 1 posts with 11 comments, i have 1 post with 9 comments, i have 1 post with 5 comments, i have 1 post with 4 comments, # i have 1 post with 3 comments, i have 2 posts with 2 comments, i have 5 with one comment, i have 15 posts with 0 comments
## these are the values of # of posts and no post_count taken into consideration
the params
[1, 1, 1, 1, 1, 2, 5, 15]
## i am not sure how to articulate the meaning here
the result
[1.0,8.0],[7.0,1.0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment