Overview: Adding court rating functionality to the AddCourt and CourtModal components. The rating is on a 1-5 scale (only integers) and accepts a simple text input. When a rating is added, it is added to a 'ratings' array object and the average of these ratings is calculated to return an 'Average Rating' to the user. The user can also see how many people have rated the court.
Data Model Changes: In firestore, two fields are added to each court document: avgRating (data type of Number) and rating (data type of array, which holds a list of integer ratings). For those courts that already exist in firestore, the logic is designed to add these fields for the first time when a court modal is accessed.
Changes:
On the 'AddCourt' form there is now an input field for adding a court rating
On the 'Court Modal' form there is now an input field to add a rating underneath the 'schedule a game' functionality when a user is logged in. It only accepts integer values from 1-5.
Users can see the average rating and number of ratings on the court modal whether or not they are logged in
Future work:
Could make the rating system more aesthetically pleasing by adding clickable stars, or some other icon, that the user can interact with instead of typing the rating in a text box.
Issue #30
Overview: Adding court rating functionality to the
AddCourt
andCourtModal
components. The rating is on a 1-5 scale (only integers) and accepts a simple text input. When a rating is added, it is added to a 'ratings' array object and the average of these ratings is calculated to return an 'Average Rating' to the user. The user can also see how many people have rated the court.Data Model Changes: In firestore, two fields are added to each court document:
avgRating
(data type of Number) andrating
(data type of array, which holds a list of integer ratings). For those courts that already exist in firestore, the logic is designed to add these fields for the first time when a court modal is accessed.Changes:
Future work: