-
Notifications
You must be signed in to change notification settings - Fork 3
Description
In @OliCallaghan's caching mechanism (#10), there needs to be two extra fields called rating and user_count. The user_count will be incremented every time a user rates an answer.
We will add that specific user's rating of the question to the rating field in the database for that question.
This is so that we can get the average rating by dividing rating by user_count.
For example. User A looks at a question and rates it as 4 out of 5. The rating field in the database will now equal 5 and the user_count will be 1. Now, User B looks at the same question and rates it as 5 out of 5. The rating field in the database for that question will now equal 9 (4 + 5) and the user_count will equal 2 (1 + 1).
Therefore the average rating for that particular question is now 9 / 2 = 4.5.
I'm thinking ⭐⭐⭐⭐⭐ for the front end rating.
I'm willing to do the front end rating and link it back into the application if perhaps @OliCallaghan makes an API so users can rate the questions? Questions are going to need a unique and numeric ID - pretty easy in MySQL but I'm not sure if you decided MySQL / MongoDB?