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

Publishables are broken when listed in nested categories #101

Closed
JirkaChadima opened this issue Jun 13, 2012 · 2 comments
Closed

Publishables are broken when listed in nested categories #101

JirkaChadima opened this issue Jun 13, 2012 · 2 comments

Comments

@JirkaChadima
Copy link
Contributor

Description

This was tested in Ella 3.0.0.

We have following category structure:

/
/category1/
/category1/category2/

And (at least) three articles that are listed in both category1 and category2. When you access /category1/, ella gets stuck in an infinite loop.

The problem seems to be in ella.core.managers.ListingManager.get_listing method where the total count of listings can be greater than all possible distinct publishables. For less then 3 articles listed in the same fashion, the code works OK (Because of the magic padding/skip constant).

I think the solution would be to change the count variable in said method to something like:

distinct = qset.filter(category=category).distinct().count()
count = min(distinct, count)
@honzakral
Copy link
Member

If you could provide a test case for this example we can work out a solution. Using distinct queryset is not acceptable.

Thanks

@JirkaChadima
Copy link
Contributor Author

Just quick and dirty in gist. This should produce an infinite loop as described above.

https://gist.github.com/2925237

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