SubjectRefresh / refresh

A Machine Learning Question Generator
Other
4 stars 3 forks source link

Question rating system #18

Open developius opened 9 years ago

developius commented 9 years ago

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 :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?

popey456963 commented 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.

developius commented 9 years ago

@popey456963 with regards to the Node HTTP API, of course - I can just link the front end into that.

developius commented 9 years ago

Can't be done until #10 is resolved @OliCallaghan.

developius commented 9 years ago

Nearly complete due to the status of #10