plezanje-net / api

NestJS GraphQL web server
GNU General Public License v3.0
7 stars 2 forks source link

383 star rating calcs update #133

Closed salamca closed 2 years ago

salamca commented 2 years ago

a ~~Adds number of star rating votes to the route table. (we need this if we want to show stars only if a certain number of votes are given).~~

Moves star rating trigger logic out of the db and into nest service. I believe it makes the code more manageable/readable.

b Adds resolver with a query for getting user's star rating for a set of routes.

To test: a1. Query some routes and get their nrOfStarRating votes and calculated star rating. a2. Log some routes and star rate them a3. do step a1 again and check results.

b1. Query starRatings for some routes with some user.

Whole logic for calculating starRating of a route is now in BE. It is implemented as discussed. Details are in the comments of the calc function.

Test this with: https://github.com/plezanje-net/web/pull/414