In my app users are able to rate each others work from 1-5. My issue is that I want the user’s personal displayed rating to update after they receive 5 ratings and update again after the receive another 5 ratings (this is to ensure anonymity with ratings).
How would you set this up in the database? I can’t figure out a way to grab the 5 at a time.
I can’t offer an elegant solution for this… rather “straightforward” one. Here is the logic:
you need to have 5 properties for “ratings”, 1 property to address the current rating (“cursor”), and 1 property to store the “public” rating
“cursor” will be changing from 1 to 5, and will determine, which “rating” you’ll update
to update the rating, you have 5 conditional actions, dependent on cursor value (you update rating1 if cursor = 1, rating2 if cursor = 2, etc)
after you update the ratingX, you increase cursor by 1
then you have an additional conditional action, when cursor = 6. At this action you calculate the new average rating and put it to “public rating” property
and then you have another conditional action, when cursor = 6: you set cursor to 1.
And the next 5 reviews will be updating the ratings again.
As for me, this should work. Not an elegant solution, though…