Open developius opened 9 years ago
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.
@popey456963 with regards to the Node HTTP API, of course - I can just link the front end into that.
Can't be done until #10 is resolved @OliCallaghan.
Nearly complete due to the status of #10
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 therating
field in the database for that question. This is so that we can get the average rating by dividingrating
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 now9 / 2 = 4.5
.I'm thinking :star::star::star::star::star: 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?