The SUSI SKill CMS provides an option to rate and review a skill. These feedbacks help the skill creators to improve the skills. Also, the ratings and reviews can be updated by the reviewer. But the CMS only provides the current rating of a skill. What if a user or a developer wants to see how that skill has performed over time? Are there any improvements in the skill or not?
For that, we need the skill ratings over time !
Server side implementation
Create a ratingsOverTime.json file to store the monthly average rating of the skills and make a JSONTray object for that in src/ai/susi/DAO.java file. The JSON file contains the timestamp for every month, the average ratings on a skill in that month and the total number of ratings in that month.
Now whenever a user rates a skill, the data in ratingsOverTime.json needs to be updated. For this fetch the overall rating data of the current month. Multiply the average rating with the total number of ratings (count) of that month.
sum = average_rating X number_of_ratings
Then add the rating given by the current user to this sum and divide by count + 1 to again get the new average rating. Also increment the total number of ratings by 1.
new_sum = sum + rating_by_user
new_avg = new_sum/(count+1)
number_of_ratings = number_of_ratings + 1
Now we have got the ratings over time stored in ratingsOverTime.json file. An API to access this data is also required. So create an API GetRatingOverTime.java returns the ratings over time of a particular skill. The API has the following attributes :
Endpoint : /cms/getRatingsOverTime.json
Minimum user role : anonymous
Parameters : model, group, language and skill
It fetches the data corresponding to the skill from ratingsOverTime.json and returns it to the CMS.
Add this API to SusiServer.java
- 5 Star Skill Rating System https://docs.google.com/document/d/1uzi3WoLV18L9gV5S1-rf4JlH4GC8AP28DRk3hpqNPpA/edit?usp=sharing