From 9c63c307ea9adb0ff17b993b97aeb2c2490c2f68 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Tue, 16 Oct 2018 14:48:36 +0100 Subject: [PATCH] Added extra category subdivisions. --- .../neviyn/observationdatabase/Controller.kt | 30 ++++-- .../co/neviyn/observationdatabase/Entity.kt | 7 +- .../observationdatabase/ControllerTest.kt | 22 ++-- .../observationdatabase/RepositoryTest.kt | 100 +++++++++++------- frontend/src/views/Observation.vue | 55 ++++++++-- frontend/src/views/StartNew.vue | 1 - 6 files changed, 143 insertions(+), 72 deletions(-) diff --git a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Controller.kt b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Controller.kt index 6117e05..29dcb90 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Controller.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Controller.kt @@ -92,8 +92,11 @@ class Controller { whom = newObservation.whom, monitoring = overallScores[RatingCategory.MONITORING], conservatism = overallScores[RatingCategory.CONSERVATISM], + controlProcedural = overallScores[RatingCategory.CONTROL_PROCEDURAL], control = overallScores[RatingCategory.CONTROL], - teamwork = overallScores[RatingCategory.TEAMWORK], + teamworkCommunications = overallScores[RatingCategory.TEAMWORK_COMMUNICATIONS], + teamworkLeadership = overallScores[RatingCategory.TEAMWORK_LEADERSHIP], + teamworkWorkload = overallScores[RatingCategory.TEAMWORK_WORKLOAD], knowledge = overallScores[RatingCategory.KNOWLEDGE], entries = newObservation.entries, tutors = tutors @@ -152,12 +155,15 @@ class Controller { if (data.isEmpty()) return ChartData(listOf(), listOf()) val groupedData = data.asSequence().groupBy { it.date }.map { entry -> AverageData( - entry.value.asSequence().mapNotNull { it.monitoring }.average(), - entry.value.asSequence().mapNotNull { it.control }.average(), - entry.value.asSequence().mapNotNull { it.conservatism }.average(), - entry.value.asSequence().mapNotNull { it.teamwork }.average(), - entry.value.asSequence().mapNotNull { it.knowledge }.average(), - entry.key + monitoring = entry.value.asSequence().mapNotNull { it.monitoring }.average(), + controlProcedural = entry.value.asSequence().mapNotNull { it.controlProcedural }.average(), + control = entry.value.asSequence().mapNotNull { it.control }.average(), + conservatism = entry.value.asSequence().mapNotNull { it.conservatism }.average(), + teamworkCommunications = entry.value.asSequence().mapNotNull { it.teamworkCommunications }.average(), + teamworkLeadership = entry.value.asSequence().mapNotNull { it.teamworkLeadership }.average(), + teamworkWorkload = entry.value.asSequence().mapNotNull { it.teamworkWorkload }.average(), + knowledge = entry.value.asSequence().mapNotNull { it.knowledge }.average(), + date = entry.key ) }.toList() val dates = groupedData.map { it.date.toString("yyyy-MM-dd") } @@ -165,9 +171,12 @@ class Controller { labels = dates, datasets = listOf( ChartDataset("Monitoring", "#F90", groupedData.map { it.monitoring }), + ChartDataset("Control Procedural", "#3F0", groupedData.map { it.controlProcedural }), ChartDataset("Control", "#3F0", groupedData.map { it.control }), ChartDataset("Conservatism", "#33F", groupedData.map { it.conservatism }), - ChartDataset("Teamwork", "#FF0", groupedData.map { it.teamwork }), + ChartDataset("Teamwork Communication", "#FF0", groupedData.map { it.teamworkCommunications }), + ChartDataset("Teamwork Leadership", "#FF0", groupedData.map { it.teamworkLeadership }), + ChartDataset("Teamwork Workload", "#FF0", groupedData.map { it.teamworkWorkload }), ChartDataset("Knowledge", "#000", groupedData.map { it.knowledge }) ) ) @@ -176,9 +185,12 @@ class Controller { data class AverageData( val monitoring: Double, + val controlProcedural: Double, val control: Double, val conservatism: Double, - val teamwork: Double, + val teamworkCommunications: Double, + val teamworkLeadership: Double, + val teamworkWorkload: Double, val knowledge: Double, val date: LocalDate ) \ No newline at end of file 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 e60ad4d..19a76ae 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt @@ -57,7 +57,7 @@ enum class TrainingType { } enum class RatingCategory { - MONITORING, CONTROL, CONSERVATISM, TEAMWORK, KNOWLEDGE + MONITORING, CONTROL_PROCEDURAL, CONTROL, CONSERVATISM, TEAMWORK_COMMUNICATIONS, TEAMWORK_LEADERSHIP, TEAMWORK_WORKLOAD, KNOWLEDGE } /** @@ -81,9 +81,12 @@ data class Observation( @Column(nullable = false) val whom: String, val monitoring: Double?, + val controlProcedural: Double?, val control: Double?, val conservatism: Double?, - val teamwork: Double?, + val teamworkCommunications: Double?, + val teamworkLeadership: Double?, + val teamworkWorkload: Double?, val knowledge: Double?, @ElementCollection val entries: List, diff --git a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ControllerTest.kt b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ControllerTest.kt index 906ff6e..63686a3 100644 --- a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ControllerTest.kt +++ b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/ControllerTest.kt @@ -94,7 +94,7 @@ class ControllerTest { doReturn(Optional.of(site)).`when`(siteRepository).findById(1) doReturn(listOf(tutor)).`when`(tutorRepository).findAllById(listOf(1)) val newData = NewObservation(1, TrainingType.INITIAL, "An Observation", "Group A", listOf(Entry(RatingCategory.MONITORING, 5, "", "")), listOf(1)) - val observation = Observation(1, site, LocalDate.now(), TrainingType.INITIAL, "An Observation", "Group A", 5.0, 5.0, 5.0, .05, 5.0, newData.entries, setOf(tutor)) + val observation = Observation(1, site, LocalDate.now(), TrainingType.INITIAL, "An Observation", "Group A", 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, newData.entries, setOf(tutor)) doReturn(observation).`when`(observationRepository).save(ArgumentMatchers.any()) val result = controller.addObservation(newData) assertEquals(1L, result) @@ -112,8 +112,9 @@ class ControllerTest { val request = ObservationsRequest(1, null, "", LocalDate.now(), LocalDate.now()) val site = Site(1, "Area 51") val observation = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf()) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf()) doReturn(Optional.of(site)).`when`(siteRepository).findById(1) doReturn(listOf(observation)) .`when`(observationRepository).findBySiteAndDateBetween(site, LocalDate.now(), LocalDate.now()) @@ -127,8 +128,9 @@ class ControllerTest { val request = ObservationsRequest(1, null, "Group A", LocalDate.now(), LocalDate.now()) val site = Site(1, "Area 51") val observation = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "Group A", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf()) + type = TrainingType.INITIAL, observed = "1", whom = "Group A", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf()) doReturn(Optional.of(site)).`when`(siteRepository).findById(1) doReturn(listOf(observation)) .`when`(observationRepository).findBySiteAndWhomAndDateBetween(site, "Group A", LocalDate.now(), LocalDate.now()) @@ -143,8 +145,9 @@ class ControllerTest { val site = Site(1, "Area 51") val tutor = Tutor(1, "Mr Unknown", site) val observation = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) doReturn(Optional.of(tutor)).`when`(tutorRepository).findById(1) doReturn(listOf(observation)) .`when`(observationRepository).findByTutorsAndDateBetween(tutor, LocalDate.now(), LocalDate.now()) @@ -159,8 +162,9 @@ class ControllerTest { val site = Site(1, "Area 51") val tutor = Tutor(1, "Mr Unknown", site) val observation = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "Group A", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "Group A", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) doReturn(Optional.of(tutor)).`when`(tutorRepository).findById(1) doReturn(listOf(observation)) .`when`(observationRepository).findByTutorsAndWhomAndDateBetween(tutor, "Group A", LocalDate.now(), LocalDate.now()) diff --git a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt index 97e1acf..9f69d32 100644 --- a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt +++ b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/RepositoryTest.kt @@ -50,17 +50,21 @@ class RepositoryTest { val tutor = entityManager.persist(Tutor(name = "X", site = correctSite)) val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite)) val tooEarly = Observation(site = correctSite, date = LocalDate.now().minusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) val tooLate = Observation(site = correctSite, date = LocalDate.now().plusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) val wrongSite = Observation(site = incorrectSite, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor2)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor2)) val justRight = Observation(site = correctSite, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) entityManager.persist(tooEarly) entityManager.persist(tooLate) entityManager.persist(wrongSite) @@ -77,20 +81,25 @@ class RepositoryTest { val tutor = entityManager.persist(Tutor(name = "X", site = correctSite)) val tutor2 = entityManager.persist(Tutor(name = "N", site = incorrectSite)) val tooEarly = Observation(site = correctSite, date = LocalDate.now().minusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) val tooLate = Observation(site = correctSite, date = LocalDate.now().plusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) val wrongSite = Observation(site = incorrectSite, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor2)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor2)) val justRight = Observation(site = correctSite, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) val wrongWhom = Observation(site = correctSite, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G2", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G2", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(tutor)) entityManager.persist(tooEarly) entityManager.persist(tooLate) entityManager.persist(wrongSite) @@ -107,20 +116,25 @@ class RepositoryTest { val correctTutor = entityManager.persist(Tutor(name = "X", site = site)) val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site)) val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val tooLate = Observation(site = site, date = LocalDate.now().plusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val wrongTutor = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(incorrectTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(incorrectTutor)) val justRight = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val justRightMultipleTutors = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor, incorrectTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor, incorrectTutor)) entityManager.persist(tooEarly) entityManager.persist(tooLate) entityManager.persist(wrongTutor) @@ -143,23 +157,29 @@ class RepositoryTest { val correctTutor = entityManager.persist(Tutor(name = "X", site = site)) val incorrectTutor = entityManager.persist(Tutor(name = "N", site = site)) val tooEarly = Observation(site = site, date = LocalDate.now().minusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val tooLate = Observation(site = site, date = LocalDate.now().plusDays(5), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val wrongTutor = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(incorrectTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(incorrectTutor)) val justRight = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val wrongGroup = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G2", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G2", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor)) val justRightMultipleTutors = Observation(site = site, date = LocalDate.now(), - type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, - control = 4.0, conservatism = 3.0, teamwork = 2.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor, incorrectTutor)) + type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0, + control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0, + teamworkWorkload = 1.0, knowledge = 1.0, entries = listOf(), tutors = setOf(correctTutor, incorrectTutor)) entityManager.persist(tooEarly) entityManager.persist(tooLate) entityManager.persist(wrongTutor) diff --git a/frontend/src/views/Observation.vue b/frontend/src/views/Observation.vue index b937517..b9a66c6 100644 --- a/frontend/src/views/Observation.vue +++ b/frontend/src/views/Observation.vue @@ -20,20 +20,38 @@ - +
{{ totals[2] }}
- +
{{ totals[3] }}
+ + + +
{{ totals[4] }}
+
+
+ + + +
{{ totals[5] }}
+
+
+ + + +
{{ totals[6] }}
+
+
-
{{ totals[4] }}
+
{{ totals[7] }}
@@ -45,9 +63,12 @@ + - + + + @@ -138,7 +159,7 @@ export default { improvements: null } ], - totals: [0, 0, 0, 0, 0], + totals: [0, 0, 0, 0, 0, 0, 0, 0], submitPassword: null }; }, @@ -176,8 +197,8 @@ export default { this.updateTotals(); }, updateTotals: function() { - var iTotals = [0, 0, 0, 0, 0]; - var counts = [0, 0, 0, 0, 0]; + var iTotals = [0, 0, 0, 0, 0, 0, 0, 0]; + var counts = [0, 0, 0, 0, 0, 0, 0, 0]; this.observations.forEach(function(element) { if (element.rating > 0) { switch (element.type) { @@ -185,22 +206,34 @@ export default { iTotals[0] += element.rating; counts[0] += 1; break; - case "CONTROL": + case "CONTROL_PROCEDURAL": iTotals[1] += element.rating; counts[1] += 1; break; - case "CONSERVATISM": + case "CONTROL": iTotals[2] += element.rating; counts[2] += 1; break; - case "TEAMWORK": + case "CONSERVATISM": iTotals[3] += element.rating; counts[3] += 1; break; - case "KNOWLEDGE": + case "TEAMWORK_COMMUNICATIONS": iTotals[4] += element.rating; counts[4] += 1; break; + case "TEAMWORK_LEADERSHIP": + iTotals[5] += element.rating; + counts[5] += 1; + break; + case "TEAMWORK_WORKLOAD": + iTotals[6] += element.rating; + counts[6] += 1; + break; + case "KNOWLEDGE": + iTotals[7] += element.rating; + counts[7] += 1; + break; } } }); diff --git a/frontend/src/views/StartNew.vue b/frontend/src/views/StartNew.vue index 512967e..56bb730 100644 --- a/frontend/src/views/StartNew.vue +++ b/frontend/src/views/StartNew.vue @@ -99,7 +99,6 @@ export default { }; }, mounted() { - this.resetStore(); Vue.axios .get("/site") .then(response => {