Added extra category subdivisions.

This commit is contained in:
neviyn 2018-10-16 14:48:36 +01:00
parent 73f1640515
commit 9c63c307ea
6 changed files with 143 additions and 72 deletions

View File

@ -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
)

View File

@ -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<Entry>,

View File

@ -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())

View File

@ -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)

View File

@ -20,20 +20,38 @@
</b-row>
<b-row align-v="center" class="sidebar-vert-padding">
<b-col class="centered-image">
<img src="../assets/Conservatism.svg" class="image-opacity"/>
<img src="../assets/Control.svg" class="image-opacity"/>
<div class="image-centered-text">{{ totals[2] }}</div>
</b-col>
</b-row>
<b-row align-v="center" class="sidebar-vert-padding">
<b-col class="centered-image">
<img src="../assets/Teamwork.svg" class="image-opacity"/>
<img src="../assets/Conservatism.svg" class="image-opacity"/>
<div class="image-centered-text">{{ totals[3] }}</div>
</b-col>
</b-row>
<b-row align-v="center" class="sidebar-vert-padding">
<b-col class="centered-image">
<img src="../assets/Teamwork.svg" class="image-opacity"/>
<div class="image-centered-text">{{ totals[4] }}</div>
</b-col>
</b-row>
<b-row align-v="center" class="sidebar-vert-padding">
<b-col class="centered-image">
<img src="../assets/Teamwork.svg" class="image-opacity"/>
<div class="image-centered-text">{{ totals[5] }}</div>
</b-col>
</b-row>
<b-row align-v="center" class="sidebar-vert-padding">
<b-col class="centered-image">
<img src="../assets/Teamwork.svg" class="image-opacity"/>
<div class="image-centered-text">{{ totals[6] }}</div>
</b-col>
</b-row>
<b-row align-v="center">
<b-col class="centered-image">
<img src="../assets/Knowledge.svg" class="image-opacity"/>
<div class="image-centered-text">{{ totals[4] }}</div>
<div class="image-centered-text">{{ totals[7] }}</div>
</b-col>
</b-row>
</b-container>
@ -45,9 +63,12 @@
<b-form-select v-bind:value="item.type" @change="changeType(index, $event)" required>
<option :value=null>Please select an option</option>
<option value="MONITORING">Monitoring</option>
<option value="CONTROL_PROCEDURAL">Control Procedural</option>
<option value="CONTROL">Control</option>
<option value="CONSERVATISM">Conservatism</option>
<option value="TEAMWORK">Teamwork</option>
<option value="TEAMWORK_COMMUNICATIONS">Teamwork Communications</option>
<option value="TEAMWORK_LEADERSHIP">Teamwork Leadership</option>
<option value="TEAMWORK_WORKLOAD">Teamwork Workload</option>
<option value="KNOWLEDGE">Knowledge</option>
</b-form-select>
</b-form-group>
@ -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;
}
}
});

View File

@ -99,7 +99,6 @@ export default {
};
},
mounted() {
this.resetStore();
Vue.axios
.get("/site")
.then(response => {