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) &&