bookwyrm-social / bookwyrm

Social reading and reviewing, decentralized with ActivityPub
http://joinbookwyrm.com/
Other
2.24k stars 263 forks source link

Single rating for one book per one user #1086

Open R1BLH opened 3 years ago

R1BLH commented 3 years ago

When I write a review of a book, I rate it in the review. However, I can also rate it separately. And they may turn out to be different. The final rating of a book is the arithmetic average.

It would be logical for one user to give one rating to one book. I mean, the database should store only the last book rating (from each user).

NonSparkly commented 2 years ago

I ran into this one and decided to double check something.

When going to a book and changing ones rating it, the newly created 'ratings' post doesn't automatically overwrite the users latest rating of that book, meaning that one needs to manually go in and remove the last status post to only have a single rating count.

Combined with the above described arithmetic average, this means that any one user could infinitely rate a re-book and get an outsized amount of influence on that books overall rating.

amancior23 commented 9 months ago

Hello, I'd love to work on this issue!

amancior23 commented 8 months ago

Hello @mouse-reeve , for the solution were you hoping to remove the ability to submit multiple ratings or allow multiple ratings but only count the user's most recent rating?

mouse-reeve commented 8 months ago

It would be to only count the most recent rating

RokeJulianLockhart commented 8 months ago

https://github.com/bookwyrm-social/bookwyrm/issues/1086#issue-892379804

@cats-shadow, I don't think we should only store the last rating — why remove functionality? However, we should disallow mutiple simultaneous reviews per user. I think that past review should only be exposed a rating history, if that makes sense. I have found the rating system a little confusing too.

R1BLH commented 8 months ago

@RokeJulianLockhart For myself, I don't see the point of ranking history, to be honest. I am absolutely not interested in how my attitude to the book changed, in addition I remember only the last impressions. :) Rating history makes sense only if you regularly reread the book (not once and not twice), and keep some kind of analytics. Personally, I don't do that. I just read books. The good ones (rating 4 or 5 on my scale) I sometimes reread. The ones rated 3 and below on my scale, I reread only by accident, only if I forget that I have read them (so far, I have no complaints about my memory :) ).

But the ability to rate a book in several unrelated places of the interface just leads to the described.

See screenshot. изображение

amancior23 commented 8 months ago

Hello @mouse-reeve, @Robel-003 and I have spent some time navigating through various directories, with a focus on the model and view layers, attempting to familiarize ourselves with the functionalities encapsulated within each file. Despite these efforts, we’ve hit a roadblock in pinpointing the exact implementation of the rating system. We were wondering if you could provide some guidance or point us in the direction of where the rating system's logic is primarily handled within the codebase. Any insights or suggestions on specific files or modules to look at would be greatly appreciated. Thank you!

joachimesque commented 8 months ago

The calculations for books are made for each use of the calculation. Right now there’s no common code, it’s all replicated at various places:

I haven’t contributed in a long while so I might be mistaken in my approach, but here’s how I would go about it: the ratings depend on the book reviews. Depending on the different contexts, we have different filters for the models.Review.objects. All of these queries should have an additionnal filter that only takes one review with rating per user, and that that review should be the latest. It might be a good idea to see if you can make an utility to get the rating of a book, so that these four occurences could use it as an utility, instead of reimplementing the same calculation based on query filters that are slightly different.