From 8016c4163e3f11b0da8775a3bb82e2d2ed7098ab Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Fri, 16 Nov 2018 14:47:12 +0000 Subject: [PATCH] Added Day shift selector entry, temporary diversion from task database csv style --- .../main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt | 6 +++--- frontend/src/views/StartNew.vue | 1 + 2 files changed, 4 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 b7f73fb..bffe1fc 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt @@ -99,7 +99,7 @@ data class Observation( val persons: Set ) { fun toCsvFormat(): String { - return ",,\"${tutors.elementAt(0).name}\",$date,\"$observed\",\"Training\",\"Performance Improvement - Training\",\"${site.name}\",\"N/A\"," + + return ",,\"${tutors.joinToString { it.name }}\",$date,\"$observed\",\"Training\",\"Performance Improvement - Training\",\"${site.name}\",\"N/A\"," + "${roundScore(monitoring)},${roundScore(controlProcedural)},${roundScore(control)}," + "${roundScore(conservatism)},${roundScore(teamworkCommunications)},${roundScore(teamworkLeadership)}," + "${roundScore(teamworkWorkload)},${roundScore(knowledge)},\"${getStrengths(RatingCategory.MONITORING)}\"," + @@ -113,11 +113,11 @@ data class Observation( } private fun getStrengths(category: RatingCategory): String { - return entries.asSequence().filter { it.type == category }.map { it.strengths }.joinToString() + return entries.asSequence().filter { it.type == category && it.strengths.isNotBlank() }.map { it.strengths }.joinToString() } private fun getImprovements(category: RatingCategory): String { - return entries.asSequence().filter { it.type == category }.map { it.improvements }.joinToString() + return entries.asSequence().filter { it.type == category && it.improvements.isNotBlank() }.map { it.improvements }.joinToString() } private fun roundScore(input: Double?): String { diff --git a/frontend/src/views/StartNew.vue b/frontend/src/views/StartNew.vue index 12c769c..9b018d3 100644 --- a/frontend/src/views/StartNew.vue +++ b/frontend/src/views/StartNew.vue @@ -41,6 +41,7 @@ +