Compare commits

..

6 Commits

5 changed files with 36 additions and 70 deletions

View File

@ -60,10 +60,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>

View File

@ -93,9 +93,9 @@ data class Observation(
) {
fun toCsvFormat(): String {
fun escapeSpecialCharacters(data: String): String {
return data.replace("\"", "\"\"").replace("\n", "")
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")},\"${escapeSpecialCharacters(person)}, ${type.name} ${scenarios.joinToString { escapeSpecialCharacters(it.title) }}\"," +
"\"Training\",\"Operations - Shift Operations\",\"${site.name}\",\"N/A\"," +
"${roundScore(monitoring)},${roundScore(controlProcedural)},${roundScore(control)}," +
"${roundScore(conservatism)},${roundScore(teamworkCommunications)},${roundScore(teamworkLeadership)}," +

View File

@ -1,20 +0,0 @@
package uk.co.neviyn.observationdatabase
import org.springframework.context.annotation.Configuration
import org.springframework.messaging.simp.config.MessageBrokerRegistry
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
import org.springframework.web.socket.config.annotation.StompEndpointRegistry
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
@Configuration
@EnableWebSocketMessageBroker
class WebSocketConfig : WebSocketMessageBrokerConfigurer {
override fun configureMessageBroker(registry: MessageBrokerRegistry) {
registry.enableSimpleBroker("/ws")
}
override fun registerStompEndpoints(registry: StompEndpointRegistry) {
registry.addEndpoint("/websocket").setAllowedOrigins("http://localhost:8080", "http://127.0.0.1:8080").withSockJS()
}
}

View File

@ -1,6 +1,10 @@
<template>
<b-container fluid>
<b-container v-if="type != null && whom != null && site != null && tutors != null" fluid style="padding-left: 130px;">
<b-container
v-if="type != null && whom != null && site != null && tutors != null"
fluid
style="padding-left: 130px;"
>
<h3>
<v-icon name="tag" scale="1.5" />
{{ type }}&nbsp;/&nbsp;{{ whom }}
@ -400,7 +404,7 @@ export default {
},
handleSubmit() {
var form = document.getElementById("submission-form");
var notObservedValue = 0
var notObservedValue = 0;
if (form.checkValidity()) {
let axiosConfig = {
auth: {
@ -439,113 +443,99 @@ export default {
title: scenario.title,
monitoringRating:
monitoring.length > 0
? monitoring.length > 1
? monitoring.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / monitoring.length
: monitoring[0].rating
? Math.round(self.totals[0])
: notObservedValue,
monitoringStrengths: monitoring
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join("; "),
monitoringImprovements: monitoring
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join("; "),
controlProceduralRating:
controlProcedural.length > 0
? controlProcedural.length > 1
? controlProcedural.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / controlProcedural.length
: controlProcedural[0].rating
? Math.round(self.totals[1])
: notObservedValue,
controlProceduralStrengths: controlProcedural
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join("; "),
controlProceduralImprovements: controlProcedural
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join("; "),
controlRating:
control.length > 0
? control.length > 1
? control.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / control.length
: control[0].rating
? Math.round(self.totals[2])
: notObservedValue,
controlStrengths: control
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join("; "),
controlImprovements: control
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join("; "),
controlImprovements: control.map((entry) => entry.AFIs).join("; "),
conservatismRating:
conservatism.length > 0
? conservatism.length > 1
? conservatism.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / conservatism.length
: conservatism[0].rating
? Math.round(self.totals[3])
: notObservedValue,
conservatismStrengths: conservatism
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join(";"),
conservatismImprovements: conservatism
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join(";"),
teamworkCommunicationsRating:
teamworkCommunications.length > 0
? teamworkCommunications.length > 1
? teamworkCommunications.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / teamworkCommunications.length
: teamworkCommunications[0].rating
? Math.round(self.totals[4])
: notObservedValue,
teamworkCommunicationsStrengths: teamworkCommunications
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join(";"),
teamworkCommunicationsImprovements: teamworkCommunications
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join(";"),
teamworkLeadershipRating:
teamworkLeadership.length > 0
? teamworkLeadership.length > 1
? teamworkLeadership.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / teamworkLeadership.length
: teamworkLeadership[0].rating
? Math.round(self.totals[5])
: notObservedValue,
teamworkLeadershipStrengths: teamworkLeadership
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join(";"),
teamworkLeadershipImprovements: teamworkLeadership
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join(";"),
teamworkWorkloadRating:
teamworkWorkload.length > 0
? teamworkWorkload.length > 1
? teamworkWorkload.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / teamworkWorkload.length
: teamworkWorkload[0].rating
? Math.round(self.totals[6])
: notObservedValue,
teamworkWorkloadStrengths: teamworkWorkload
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join(";"),
teamworkWorkloadImprovements: teamworkWorkload
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join(";"),
knowledgeRating:
knowledge.length > 0
? knowledge.length > 1
? knowledge.reduce(
(a, b) => parseInt(a.rating) + parseInt(b.rating)
) / knowledge.length
: knowledge[0].rating
? Math.round(self.totals[7])
: notObservedValue,
knowledgeStrengths: knowledge
.map((entry) => entry.strengths)
.filter((entry) => entry.length > 0)
.join(";"),
knowledgeImprovements: knowledge
.map((entry) => entry.AFIs)
.filter((entry) => entry.length > 0)
.join(";"),
});
});

View File

@ -13,7 +13,7 @@
<properties>
<main.basedir>${project.basedir}</main.basedir>
<revision>2020_09_18</revision>
<revision>2021_07_19</revision>
</properties>
<modules>