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

Created on 12 Mar 2021  路  14Comments  路  Source: publiclab/plots2

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

bug

All 14 comments

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.

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

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.

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?

https://github.com/publiclab/plots2/blob/c9349cae8af3e8ed2e27c77d9e35173a6cfa9194/test/functional/wiki_controller_test.rb#L20-L32

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

Thank you for your help!!!

@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!

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

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

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

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

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

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.

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

@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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

first-timers[bot] picture first-timers[bot]  路  3Comments

jywarren picture jywarren  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

milaaraujo picture milaaraujo  路  3Comments

first-timers[bot] picture first-timers[bot]  路  3Comments