Closed Veggissss closed 6 months ago
Currently there are no explicit checks for value range. So users can send Attribute values outside of intended ranges.
A simple check like this can be added in RatingFetcher::addAttributes():
// Verify that score is within bounds
val attributeScore = attributeInput["score"] as Double
if (attributeScore < 1.0 || attributeScore > 5.0){
error("Invalid attribute score range.")
}
But I am still unsure about the ranges, if they should be 0-1:
// Verify that score is within bounds
val attributeScore = attributeInput["score"] as Double
if (attributeScore < 0 || attributeScore > 1.0){
error("Invalid attribute score range.")
}
Similar checks should also be added to editRating and createRating for Rating.score.
If we just keep the range between 0-1
, we can put the problem of actual range to frontend. So if they want to have the range be 0-10
they can render is as such, but we always want them to send and recieve a value in the 0-1
ranges.
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
This merge request includes the rework of rating Labels. Label is replaced with Attributes and AttributeCategory.
Only users with admin role can add new AttributeCategories. Regular users can add Attributes to their Ratings.