Comments (3)
@whitepaperclip - As far as we can tell, the original issue was never fixed by @drewolson.
Here we have created a failing test once more as an example
In our test, we create 6 Posts, each with 5 comments.
page =
Post
|> Post.published
|> join(:inner, [p], c in assoc(p, :comments))
|> preload([p, c], [comments: c])
|> Scrivener.Ecto.Repo.paginate
In this example, page.total_entries
ends up being 30 instead of 6. This is directly related to the fact that the preloads are not being treated properly by the current implementation and so entries are being returned for each comment instead of each post with nested comments.
We're going to once more create a fix on the same branch because #44 and #45 were never really addressed properly.
from scrivener_ecto.
@whitepaperclip - I have put back the original fix from #44, #45 so feel free to give it a spin as a temporary fix until we can have some discussion on perhaps a better approach.
master...Sitata:fix_joins_pagination_2
from scrivener_ecto.
@astjohn Thanks! Let me know if you need any help on this, because I definitely have bandwidth for the next couple weeks.
Right now I'm basically calling Repo.preload
in a ton of functions because of the issue with total_entries
, and the performance isn't ideal.
from scrivener_ecto.
Related Issues (20)
- README Documentation does not cover many important options and direct configuration
- Page number greater than total_pages should be allowed HOT 2
- 2.0.0 Wrong pagination results postgres HOT 2
- Error when trying to paginate with intersect or intersect_all
- `distinct on` requires a subquery for counting HOT 2
- Scrivener automatically adjust the page numbers yielding wrong results HOT 2
- `:uuid` being passed into Ecto as a type, rather than `Ecto.UUID` HOT 1
- Using absolute distinct with a join gets incorrect total_entries
- Cannot work with multiple databases HOT 4
- scrivener dosent load some records HOT 2
- Dependencies outdated HOT 1
- Pagination for all
- Misspelling
- Support for schema prefixes for multitenancy
- Schema prefix not fetched from query HOT 3
- Pagination is show older rows again HOT 5
- Zero page size ignored and default is returning
- Negative page numbers return first page HOT 1
- UNION queries fail
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scrivener_ecto.