Skip to content
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

Replays endpoint is returning weird data #625

Open
ville-j opened this issue Sep 15, 2023 · 2 comments
Open

Replays endpoint is returning weird data #625

ville-j opened this issue Sep 15, 2023 · 2 comments

Comments

@ville-j
Copy link
Member

ville-j commented Sep 15, 2023

If you check the response of this request https://api.elma.online/api/replay?page=0&pageSize=25&sortBy=uploaded&order=desc&levelPack=0 you can see that there's something wrong with it. It is returning almost 12k items in the count property. Rows property seems to have properly those 25 items you asked for, but shouldn't the count simply be the total number of results, not an array of all the results?

@metsavir
Copy link
Collaborator

metsavir commented Sep 15, 2023

Wow, good find 👍. Looks like nice sequelize feature.

When group is not provided, the findAndCountAll method returns an object with two properties:

  • count - an integer - the total number records matching the query
  • rows - an array of objects - the obtained records

When group is provided, the findAndCountAll method returns an object with two properties:

  • count - an array of objects - contains the count in each group and the projected attributes
  • rows - an array of objects - the obtained records

Don't remember why that group is there but maybe should just use findAll and get count with another query (Replay.count() or something) if grouping is needed.

@ville-j
Copy link
Member Author

ville-j commented Feb 6, 2024

This issue still isn't fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants