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

Sorting based on edits / page views / likes shows only 1 row on the first page of wikis #9290

Open
Manasa2850 opened this issue Mar 12, 2021 · 15 comments · Fixed by #9330
Open
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed

Comments

@Manasa2850
Copy link
Member

Please describe the problem (or idea)

When we sort wikis based on title or last edited, it works fine and shows the same number of rows on the first page before and after sorting.
However, if we sort based on edits, pages views or likes, it shows only one row on the first page.

Please show us where to look

https://publiclab.org/wiki

ezgif com-video-to-gif

@Manasa2850 Manasa2850 added the bug the issue is regarding one of our programs which faces problems when a certain task is executed label Mar 12, 2021
@gaurav2699
Copy link
Contributor

Hey @Manasa2850, I have just started out contributing to open source and already contributed to a first-timers issue. I want to try out this issue.

@gaurav2699
Copy link
Contributor

Although I checked this in my local development and this bug is not happening.

@Manasa2850
Copy link
Member Author

Hi @gaurav2699 sure you can work on it.
Even I'm not able to see the bug locally. I observed this on https://publiclab.org/wiki. Maybe @cesswairimu or @jywarren can give us more inputs on this.

@jywarren
Copy link
Member

Hi, this is a good catch, but I wonder how we can find this bug in more detail. I wonder - should we try writing a functional test for it, by building on these tests?

test 'should get wiki index' do
get :index
assert_response :success
assert_not_nil :wikis
end
test 'should get wiki index in alphabetical order' do
get :index, params: { sort: 'title' }
assert_response :success
assert assigns(:wikis).each_cons(2).all?{|i,j| "j.node_revisions.title" >= "i.node_revisions.title" }
end

Could we try to open a PR that "catches" the bug by counting the # of results on each page?

Thank you for your help!!!

@Manasa2850
Copy link
Member Author

@jywarren I'm not able to make a PR to catch that bug since I don't see it locally. I observed it on https://publiclab.org/wiki. It would be great if someone who's observing this locally too, could make the PR.
Thanks!

@gaurav2699
Copy link
Contributor

@jywarren any reason why this bug is not replicated locally?

@cesswairimu
Copy link
Collaborator

This is really weird..I think it has smth to do with pagination -- the no. of elements per page not being clearly defined, on the website I have noticed when you sort with title the number per page reduces to 8, if you go to page 2 its 3 etc the number per page keeps shifting...locally I cannot replicate too but also it doesn't paginate for me...I created upto 20 wikis and they are all showing on the first page

@gaurav2699 gaurav2699 mentioned this issue Mar 19, 2021
5 tasks
@gaurav2699
Copy link
Contributor

gaurav2699 commented Mar 19, 2021

Hey, @cesswairimu @jywarren I made a PR for this which should fix this issue. Basically, I specified the number of items on every page to be 10. Now, it paginates in local development too and this bug is not happening. Please review

@cesswairimu
Copy link
Collaborator

The changes will appear on https://stable.publiclab.org/ in 15 min or so...lets confirm there this is all fixed. Thanks everyone ❤️

@cesswairimu
Copy link
Collaborator

cesswairimu commented Mar 23, 2021

Looks like the issue is not fixed yet 🙃 https://stable.publiclab.org/wiki?sort=page_views reopening this

@cesswairimu cesswairimu reopened this Mar 23, 2021
@gaurav2699
Copy link
Contributor

This is really weird, as it was working with no issues in my local development. Maybe pagination was not the problem, or maybe we are missing something.

@cesswairimu
Copy link
Collaborator

yeah pagination now works fine on my local too...I agree we may be missing smth

@Manasa2850
Copy link
Member Author

@cesswairimu another thing I observed is that the same entry appears in multiple rows. For example, sandbox-soil appears in both row 1 and row 2. But ideally it should appear in only one of the rows. This is why the number of rows is increasing to 1031. Not sure why this is happening.

@cesswairimu
Copy link
Collaborator

oh wow, great observation...maybe we need to add "distinct" on the query fetching on index 🤔 ...I will investigate more on this and revert

@ebarry
Copy link
Member

ebarry commented Aug 10, 2021

Fascinating!!! I am seeing this also.

I captured a gif that shows how even clicking through multiple pages, only the /barnstars page is shown. I happen to like this page, but, it's really incorrect as a result.

sorting-by-likes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the issue is regarding one of our programs which faces problems when a certain task is executed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants