From 5a9906bb226748a97a9fd79642aa619ff4af2439 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Thu, 17 Sep 2020 13:36:44 +0100 Subject: [PATCH] A rating of 0 can now be used to represent an unrated fundamental --- .../main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt index 23d8c17..0c91f6f 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt @@ -93,7 +93,7 @@ data class Observation( ) { fun toCsvFormat(): String { fun escapeSpecialCharacters(data: String): String { - return data.replace("\"", "\"\"") + return data.replace("\"", "\"\"").replace("\n", "") } val dataPortion = "${date.toString("dd/MM/yyyy")},\"$person, ${type.name} ${scenarios.joinToString { it.title }}\"," + "\"Training\",\"Operations - Shift Operations\",\"${site.name}\",\"N/A\"," + @@ -121,7 +121,7 @@ data class Observation( } private fun roundScore(input: Double?): String { - if (input != null) { + if (input != null && input > 0) { return input.roundToInt().toString() } return "" @@ -185,7 +185,7 @@ data class Scenario( ) { private fun ratingValid(rating: Byte): Boolean { - return rating in 1..5 + return rating in 0..5 } fun ratingsAllValid(): Boolean { return ratingValid(monitoringRating) &&