We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This is the exact code
render json: [ { name: :assignments, data: assignments.group_by_day(:created_at).count }, { name: :assignment_visits, data: assignment_visits.group_by_day(:created_at).count }, { name: :messages, data: messages.group_by_day(:created_at).count }, { name: :telegram_chats, data: telegram_chat_records.group_by_day(:created_at).count } ]
and this is the result
Sometimes the results are not sorted by date and I don't understand why. I think it is only here where the json is an array of data.
The text was updated successfully, but these errors were encountered:
Hi @thebravoman, JSON objects are unordered, so you'll need to convert them to arrays with to_a if you want to preserve the order.
to_a
Sorry, something went wrong.
The getting started says another thing @ankane https://github.com/ankane/groupdate?tab=readme-ov-file#getting-started
Results are returned in ascending order by default, so no need to sort.
Am I missing something?
The problem is not that the json is not sorted but that the
assignments.group_by_day(:created_at).count
returns something that is not sorted and the getting started says there is no need to sort.
If you can create a minimal reproducible example or test case that shows this, happy to look into it more.
No branches or pull requests
This is the exact code
and this is the result
Sometimes the results are not sorted by date and I don't understand why.
I think it is only here where the json is an array of data.
The text was updated successfully, but these errors were encountered: