Commit 2848d57a authored by Antoine Mottier's avatar Antoine Mottier
Browse files

Make sure that score is an int between 1 and 9 included

- Score can be between 0 and 5 (double) included when being processed.
- We want a result between 1 and 9 so we multiply by 2, truncate the result to an int and bump it to 1 if value is 0 or lower it to 9 fi value is 10.
- Update .gitignore to exclude Maven release plugin files and Dolphin file browser hidden files.
parent 4d298112
Pipeline #10888 passed with stages
in 7 minutes and 31 seconds
target/
work/
pom.xml.releaseBackup
release.properties
.directory
# Secret local data (eg. credentials for testing)
*.secret
......@@ -15,3 +19,4 @@ work/
.project
.settings/
build/
......@@ -108,7 +108,9 @@ public class DatasetFactory {
*/
public long getOverallScore() {
// Multiply by 2, as average is out of 5, and score out of 10
return Math.max(1L, Math.min(10L, Math.round(2D * getNotRoundedOverallScore())));
// Truncate to get an int value (e.g. 9. becomes 9)
// Exclude value 0 and 10
return Math.max(1L, Math.min(9L, (int)(2D * getNotRoundedOverallScore())));
}
public double getNotRoundedOverallScore() {
......
......@@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment