newUI #1

Merged
neviyn merged 7 commits from newUI into master 2020-09-18 09:49:05 +01:00
Showing only changes of commit 5a9906bb22 - Show all commits

View File

@ -93,7 +93,7 @@ data class Observation(
) { ) {
fun toCsvFormat(): String { fun toCsvFormat(): String {
fun escapeSpecialCharacters(data: String): 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 }}\"," + val dataPortion = "${date.toString("dd/MM/yyyy")},\"$person, ${type.name} ${scenarios.joinToString { it.title }}\"," +
"\"Training\",\"Operations - Shift Operations\",\"${site.name}\",\"N/A\"," + "\"Training\",\"Operations - Shift Operations\",\"${site.name}\",\"N/A\"," +
@ -121,7 +121,7 @@ data class Observation(
} }
private fun roundScore(input: Double?): String { private fun roundScore(input: Double?): String {
if (input != null) { if (input != null && input > 0) {
return input.roundToInt().toString() return input.roundToInt().toString()
} }
return "" return ""
@ -185,7 +185,7 @@ data class Scenario(
) { ) {
private fun ratingValid(rating: Byte): Boolean { private fun ratingValid(rating: Byte): Boolean {
return rating in 1..5 return rating in 0..5
} }
fun ratingsAllValid(): Boolean { fun ratingsAllValid(): Boolean {
return ratingValid(monitoringRating) && return ratingValid(monitoringRating) &&