Rating system concept

How to create 5 rate system for each user?

The front end is fine, but the back end, should we have two data fields, one is the number of ratings (how much times user is rated), and other to be the amount (sum of 1 to 5)? Or if there is another way to make the calculation as easy as possible, without search to much? :slight_smile:


It depends on what are you going to use in your app. Do you just need a single aggregated (average) rate or you will be displaying individual rates too?

1 Like


It will be on the individual user level, same as Uber car drivers have a rating system, 1-5 starts, and you can submit your experience, from one to five starts, and than there is number of submitions, and total number of rating? Example 10 votes, and in total driver has 4.7 rating?

How to get to this number of 4.7 :slight_smile: Avarage rate

You will need those two fields in any way.
But if you need to control/exclude repeated ratings (same ratee, same rated, different rate), or want to allow users to revise their previous ratings, or want to account only rates not older than X years, then you probably would need to store each user’s vote.

In other words, if this rating system is going to be an important part of the app, I’d keep each vote - you don’t need to count them at the beginning, but having it to be able to extend this system in the future seems to be a good idea. If it’s just a small feature, that aggregated values would be enough, I think.

Oh, thanks for the perspective. Now trying to find out the balance, not definitely to limit users by time of when the rate is submitted, it would be hard to structure in such way, or to make a rule, as when or if user can restart the rating, or to count it only last year or so, but also due to the search, despite the valuable data?

On the other hand, now seeing how it could be great to have overall rate of a user, which is the average, but to have also individual ratings, for example how many 1s, 2s, 3s, 4,s and 5s user got, which can also be gotten only if having those 5 separate fields?

Yeap, to get this you’d need 5 fields instead of 2. But :slight_smile: should user’s low rating be accompanied by some comments describing what is wrong so they might have an insight how to improve? If this is the case, than you need those votes, at least some number of recent ones.

1 Like

Ok, good question as well! I am aware, either to create two fields in existing “credits data type” we already have, or to create one more data type for the more details of the rating. Definitely we want our users also to improve based on the feedback. Need to make a decision where to draw a line here. I think so far, 2 fields, and perhaps instant feedback sent via email to the user, including the rating submits, while saving only the two fields for the number of votes and overall rating.

What do you think? :smiley: Great one!

1 Like

Yeap, good idea!

1 Like

But still, how you calculate the average to not use too much of search from those two fields?

Not good in math, while loving the basic numbers, hope is not simple formula like 2+2… :smiley:

45 rates / 10 votings?

Exactly. Each time user votes, you need to increment rated user’s votings and add its rate to rates, so you update your data item:

  • rates = rates + new rate
  • votings = votings + 1

As the update above might be done using single “Make changes to thing…” action, no race condition is expected, so that should be enough. And when displaying ratings, you just display rates/votings value.
To optimize search, you might embed these values into User thing, so that you always have them at hand. But in this case you would need to register votes in a backend workflow because users shouldn’t have direct access to other user’s profiles in this case.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.