Further CSV updates
This commit is contained in:
parent
722d7556b9
commit
35cd2c24f0
@ -5,11 +5,11 @@ package uk.co.neviyn.observationdatabase
|
||||
*/
|
||||
fun csvHeaderString(): String {
|
||||
return "Observer,obDate,Title,Type,Department,Station,Station Focus,Scores-Monitoring,Scores-Control Procedural," +
|
||||
"Scores-Control,Scores-Conservatism,Scores-Teamwork Comms,Scores-Teamwork Leadership,Scores-Teamwork Workload,Scores-Knowledge, Skills and Attitudes," +
|
||||
"Scores-Control,Scores-Conservatism,Scores-Teamwork Comms,Scores-Teamwork Leadership,Scores-Teamwork Workload,\"Scores-Knowledge, Skills and Attitudes\"," +
|
||||
"Strengths-Monitoring,Strengths-Control Procedural,Strengths-Control,Strengths-Conservatism,Strengths-Teamwork Comms," +
|
||||
"Strengths-Teamwork Leadership,Strengths-Teamwork Workload,Strengths-Knowledge, Skills and Attitudes," +
|
||||
"Strengths-Teamwork Leadership,Strengths-Teamwork Workload,\"Strengths-Knowledge, Skills and Attitudes\"," +
|
||||
"Develop-Monitoring,Develop-Control Procedural,Develop-Control,Develop-Conservatism,Develop-Teamwork Comms," +
|
||||
"Develop-Teamwork Leadership,Develop-Teamwork Workload,Develop-Knowledge, Skills and Attitudes,ErrorPrecursors,ActionTaken"
|
||||
"Develop-Teamwork Leadership,Develop-Teamwork Workload,\"Develop-Knowledge, Skills and Attitudes\",ErrorPrecursors,ActionTaken"
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,17 +93,29 @@ data class Observation(
|
||||
val person: Person
|
||||
) {
|
||||
fun toCsvFormat(): String {
|
||||
return "\"${tutors.joinToString { it.name }}\",$date,\"${scenarios.joinToString { it.title }}\",\"Training\",\"Operations - Shift Operations\",\"${site.name}\",\"N/A\"," +
|
||||
val dataPortion = "${date.toString("dd/MM/yyyy")},\"${scenarios.joinToString { it.title }}\"," +
|
||||
"\"Training\",\"Operations - Shift Operations\",\"${site.name}\",\"N/A\"," +
|
||||
"${roundScore(monitoring)},${roundScore(controlProcedural)},${roundScore(control)}," +
|
||||
"${roundScore(conservatism)},${roundScore(teamworkCommunications)},${roundScore(teamworkLeadership)}," +
|
||||
"${roundScore(teamworkWorkload)},${roundScore(knowledge)},\"${scenarios.joinToString { it.monitoring.strengths }}\"," +
|
||||
"\"${scenarios.joinToString { it.controlProcedural.strengths }}\",\"${scenarios.joinToString { it.control.strengths }}\",\"${scenarios.joinToString { it.conservatism.strengths }}\"," +
|
||||
"\"${scenarios.joinToString { it.teamworkCommunications.strengths }}\",\"${scenarios.joinToString { it.teamworkLeadership.strengths }}\"," +
|
||||
"\"${scenarios.joinToString { it.teamworkWorkload.strengths }}\",\"${scenarios.joinToString { it.knowledge.strengths }}\"," +
|
||||
"\"${scenarios.joinToString { it.monitoring.improvements }}\",\"${scenarios.joinToString { it.controlProcedural.improvements }}\"," +
|
||||
"\"${scenarios.joinToString { it.control.improvements }}\",\"${scenarios.joinToString { it.conservatism.improvements }}\"," +
|
||||
"\"${scenarios.joinToString { it.teamworkCommunications.improvements }}\",\"${scenarios.joinToString { it.teamworkLeadership.improvements }}\"," +
|
||||
"\"${scenarios.joinToString { it.teamworkWorkload.improvements }}\",\"${scenarios.joinToString { it.knowledge.improvements }}\",;#None;#,"
|
||||
"${roundScore(teamworkWorkload)},${roundScore(knowledge)}," +
|
||||
"\"${scenarios.map { it.monitoring.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.controlProcedural.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.control.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.conservatism.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.teamworkCommunications.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.teamworkLeadership.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.teamworkWorkload.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.knowledge.strengths }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.monitoring.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.controlProcedural.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.control.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.conservatism.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.teamworkCommunications.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.teamworkLeadership.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.teamworkWorkload.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
"\"${scenarios.map { it.knowledge.improvements }.filter { it.isNotEmpty() }.joinToString(separator = "; ")}\"," +
|
||||
";#None;#,"
|
||||
return tutors.joinToString("\n") { it.name + "," + dataPortion }
|
||||
}
|
||||
|
||||
private fun roundScore(input: Double?): String {
|
||||
|
Loading…
Reference in New Issue
Block a user