You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
If we do decide MongoDB, things already have a unique ID that is given to them (albeit it is alphanumerical, not numerical). The values will never be the same, and so we wouldn't have to worry about anything like that, but the ID for the question will need to be sent to the client each time.
@OliCallaghan does know how the Node.JS API writing works (at least how to capture get requests), so I would recommend he do that, however, if he sends me the ID (as I know Mongo), I could perhaps put it in? I would also have to make a wrapper so that a user could get the current rating as well.
In @OliCallaghan's caching mechanism (#10), there needs to be two extra fields called
rating
anduser_count
. Theuser_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
byuser_count
.For example.
User A
looks at a question and rates it as 4 out of 5. Therating
field in the database will now equal 5 and theuser_count
will be 1. Now,User B
looks at the same question and rates it as 5 out of 5. Therating
field in the database for that question will now equal 9(4 + 5)
and theuser_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?
The text was updated successfully, but these errors were encountered: