-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Count to Counts with MultiValue and Count fixed #352
Conversation
@unequaled86 Thanks for the contribution. Can you provide some details as to why you want this change? I have never seen
nm, It looks like |
page = 2
limit = 10
# its add_aggregate_field for group by
posts.where(:title, :like, "%#{search_text}")
# (already not working with where bc db.query_one)
count = posts.count.run
# pagination
posts.limit(limit)
posts.offset((page - 1)*limit)
results = posts.select
{"results" => results, "pages_size" => count.fdiv(limit).ceil.to_i, "posts_size" => count.to_i}.to_json in that rest api scenario maybe we can change |
@unequaled86 ok. Thanks for the explanation. I'm not a fan of the Is this something you would be interested in looking into? |
@drujensen rewrited and its look like acceptable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Group By should not be automatically added to the count
. Only if a user specifies one should it be included. Let's just remove it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better! I prefer group_by
over group
but let me know what you think.
Minor, but you should run |
hmm, I see what you mean. Rails uses |
i run |
Perfect, could you update the tabs to use spaces? Guess it doesn't do that for you. |
i did now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work. update the documentation and add a couple more specs for group_by
. maybe include a test for chaining multiple group_by
as well. Post.group_by(:name).group_by(:age)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
@unequaled86 hate to do this to you but we merged a large breaking change #346 that is causing issues in this PR. Can you take a look? |
fixed, please merge it before happen new issues .d |
@unequaled86 Thank you |
so i can use count without group by and counts with group by