-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
"Sort by likes" button in Agriculture and Air Quality topics does not sort correctly #8598
Comments
Thanks for opening your first issue! This space is protected by our Code of Conduct - and we're here to help. |
Hey, can I work on this? |
Hi @alvesitalo, we would love your help. Go ahead . Thanks |
Thank you for reporting this @khadija-nur -- this is a valuable contribution! 🤝 |
Hi everyone, I tested locally with some posts but I can't see any problem with sorting by likes. Have you experienced this issue? @ebarry @cesswairimu |
@alvesitalo yeah, it is happening in production if you go to https://publiclab.org/tag/agriculture" and select sort by likes you will see the second and third post may have more likes than the first one. I will test locally see if I can replicate |
Hi all, thanks @khadija-nur for finding this, and @alvesitalo for looking deeper - it seems like it may be pretty intermittent, which can be really tough to debug. I wonder if we are sorting by cached likes count versus a count "on the fly" - see the model for tracking and caching likes at: Lines 1039 to 1046 in 27a3839
The page itself is using plots2/app/controllers/tag_controller.rb Lines 121 to 122 in 27a3839
But see how the template is using plots2/app/views/notes/_card.html.erb Line 55 in 27a3839
Lines 256 to 264 in 27a3839
Notice also how we aren't filtering out spam users in the |
I'll spin out that last idea about filtering banned users from |
I spun that out into a first-timers-only issue at #8639 ! I could do the same for the template change above too, if it's helpful? |
Cool, it is. Thank you for clarifying this bug @jywarren |
I just did that over at #8691 - thanks @alvesitalo! |
Sort by likes does not work in agriculture and air quality topics
When you go to "https://publiclab.org/tag/air-quality" or "https://publiclab.org/tag/agriculture"
and click on sort by drop down menu then filter by likes button the posts appear randomly
instead of being in a descending order depending on the number of likes they have
see below:
After filtering, the first post has 11 likes, the third one has 7 and the fourth has 8 likes
Please show us where to look
https://publiclab.org/tag/agriculture?order=likes
https://publiclab.org/tag/air-quality?order=likes
What's your PublicLab.org username?
username: knur
Browser, version, and operating system
Thank you!
The text was updated successfully, but these errors were encountered: