Removed unneeded entity fields, moved observation view to new format
This commit is contained in:
parent
cb58720c23
commit
d8b3c0040d
@ -20,7 +20,6 @@ data class NewObservation(
|
|||||||
val site: Long,
|
val site: Long,
|
||||||
val type: TrainingType,
|
val type: TrainingType,
|
||||||
val observed: String,
|
val observed: String,
|
||||||
val whom: String,
|
|
||||||
val scenarios: List<Scenario>,
|
val scenarios: List<Scenario>,
|
||||||
val tutors: List<Long>,
|
val tutors: List<Long>,
|
||||||
val person: String
|
val person: String
|
||||||
|
@ -87,7 +87,6 @@ class Controller {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = newObservation.type,
|
type = newObservation.type,
|
||||||
observed = newObservation.scenarios.joinToString { it.title },
|
observed = newObservation.scenarios.joinToString { it.title },
|
||||||
whom = newObservation.whom,
|
|
||||||
monitoring = newObservation.scenarios.map { it.monitoring.rating }.average(),
|
monitoring = newObservation.scenarios.map { it.monitoring.rating }.average(),
|
||||||
conservatism = newObservation.scenarios.map { it.conservatism.rating }.average(),
|
conservatism = newObservation.scenarios.map { it.conservatism.rating }.average(),
|
||||||
controlProcedural = newObservation.scenarios.map { it.controlProcedural.rating }.average(),
|
controlProcedural = newObservation.scenarios.map { it.controlProcedural.rating }.average(),
|
||||||
@ -116,34 +115,19 @@ class Controller {
|
|||||||
fun getObservations(@Valid @RequestBody observationsRequest: ObservationsRequest): List<Observation> {
|
fun getObservations(@Valid @RequestBody observationsRequest: ObservationsRequest): List<Observation> {
|
||||||
if (observationsRequest.tutor != null) {
|
if (observationsRequest.tutor != null) {
|
||||||
return tutorRepository.findById(observationsRequest.tutor).map {
|
return tutorRepository.findById(observationsRequest.tutor).map {
|
||||||
when {
|
observationRepository.findByTutorsAndDateBetweenOrderByDateAsc(tutor = it,
|
||||||
(observationsRequest.whom == null || observationsRequest.whom.isEmpty()) -> observationRepository.findByTutorsAndDateBetweenOrderByDateAsc(tutor = it,
|
|
||||||
startDate = observationsRequest.startDate,
|
startDate = observationsRequest.startDate,
|
||||||
endDate = observationsRequest.endDate)
|
endDate = observationsRequest.endDate)
|
||||||
else -> observationRepository.findByTutorsAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(tutor = it,
|
|
||||||
whom = observationsRequest.whom,
|
|
||||||
startDate = observationsRequest.startDate,
|
|
||||||
endDate = observationsRequest.endDate)
|
|
||||||
}
|
|
||||||
}.orElse(listOf())
|
}.orElse(listOf())
|
||||||
} else if (observationsRequest.person != null && observationsRequest.person.isNotEmpty() && observationsRequest.site != null) {
|
} else if (observationsRequest.person != null && observationsRequest.person.isNotEmpty() && observationsRequest.site != null) {
|
||||||
val person = personRepository.findFirstByNameLike(observationsRequest.person.toUpperCase()) ?: return listOf()
|
val person = personRepository.findFirstByNameLike(observationsRequest.person.toUpperCase()) ?: return listOf()
|
||||||
val site = siteRepository.findById(observationsRequest.site).get()
|
val site = siteRepository.findById(observationsRequest.site).get()
|
||||||
return if (observationsRequest.whom == null || observationsRequest.whom.isEmpty())
|
return observationRepository.findBySiteAndPersonAndDateBetweenOrderByDateAsc(site, person, observationsRequest.startDate, observationsRequest.endDate)
|
||||||
observationRepository.findBySiteAndPersonAndDateBetweenOrderByDateAsc(site, person, observationsRequest.startDate, observationsRequest.endDate)
|
|
||||||
else
|
|
||||||
observationRepository.findBySiteAndWhomIgnoreCaseAndPersonAndDateBetweenOrderByDateAsc(site, observationsRequest.whom, person, observationsRequest.startDate, observationsRequest.endDate)
|
|
||||||
} else if (observationsRequest.site != null) {
|
} else if (observationsRequest.site != null) {
|
||||||
return siteRepository.findById(observationsRequest.site).map {
|
return siteRepository.findById(observationsRequest.site).map {
|
||||||
when {
|
observationRepository.findBySiteAndDateBetweenOrderByDateAsc(site = it,
|
||||||
(observationsRequest.whom == null || observationsRequest.whom.isEmpty()) -> observationRepository.findBySiteAndDateBetweenOrderByDateAsc(site = it,
|
|
||||||
startDate = observationsRequest.startDate,
|
startDate = observationsRequest.startDate,
|
||||||
endDate = observationsRequest.endDate)
|
endDate = observationsRequest.endDate)
|
||||||
else -> observationRepository.findBySiteAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(site = it,
|
|
||||||
whom = observationsRequest.whom,
|
|
||||||
startDate = observationsRequest.startDate,
|
|
||||||
endDate = observationsRequest.endDate)
|
|
||||||
}
|
|
||||||
}.orElse(listOf())
|
}.orElse(listOf())
|
||||||
}
|
}
|
||||||
return listOf()
|
return listOf()
|
||||||
|
@ -3,8 +3,8 @@ package uk.co.neviyn.observationdatabase
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import org.joda.time.LocalDate
|
import org.joda.time.LocalDate
|
||||||
|
import javax.persistence.CascadeType
|
||||||
import javax.persistence.Column
|
import javax.persistence.Column
|
||||||
import javax.persistence.ElementCollection
|
|
||||||
import javax.persistence.Entity
|
import javax.persistence.Entity
|
||||||
import javax.persistence.FetchType
|
import javax.persistence.FetchType
|
||||||
import javax.persistence.GeneratedValue
|
import javax.persistence.GeneratedValue
|
||||||
@ -76,8 +76,6 @@ data class Observation(
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
val type: TrainingType,
|
val type: TrainingType,
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
val whom: String,
|
|
||||||
@Column(nullable = false)
|
|
||||||
val observed: String,
|
val observed: String,
|
||||||
val monitoring: Double?,
|
val monitoring: Double?,
|
||||||
val controlProcedural: Double?,
|
val controlProcedural: Double?,
|
||||||
@ -87,7 +85,7 @@ data class Observation(
|
|||||||
val teamworkLeadership: Double?,
|
val teamworkLeadership: Double?,
|
||||||
val teamworkWorkload: Double?,
|
val teamworkWorkload: Double?,
|
||||||
val knowledge: Double?,
|
val knowledge: Double?,
|
||||||
@ElementCollection
|
@OneToMany(cascade = [CascadeType.ALL])
|
||||||
val scenarios: List<Scenario>,
|
val scenarios: List<Scenario>,
|
||||||
@ManyToMany(mappedBy = "observations")
|
@ManyToMany(mappedBy = "observations")
|
||||||
val tutors: Set<Tutor>,
|
val tutors: Set<Tutor>,
|
||||||
@ -132,21 +130,21 @@ data class Scenario(
|
|||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
val id: Long = 0,
|
val id: Long = 0,
|
||||||
val title: String,
|
val title: String,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val monitoring: RatingComponent,
|
val monitoring: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val controlProcedural: RatingComponent,
|
val controlProcedural: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val control: RatingComponent,
|
val control: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val conservatism: RatingComponent,
|
val conservatism: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val teamworkCommunications: RatingComponent,
|
val teamworkCommunications: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val teamworkLeadership: RatingComponent,
|
val teamworkLeadership: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val teamworkWorkload: RatingComponent,
|
val teamworkWorkload: RatingComponent,
|
||||||
@OneToOne
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
val knowledge: RatingComponent
|
val knowledge: RatingComponent
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -17,13 +17,7 @@ interface ObservationRepository : CrudRepository<Observation, Long> {
|
|||||||
|
|
||||||
fun findByTutorsAndDateBetweenOrderByDateAsc(tutor: Tutor, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
fun findByTutorsAndDateBetweenOrderByDateAsc(tutor: Tutor, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
||||||
|
|
||||||
fun findBySiteAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(site: Site, whom: String, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
|
||||||
|
|
||||||
fun findByTutorsAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(tutor: Tutor, whom: String, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
|
||||||
|
|
||||||
fun findBySiteAndPersonAndDateBetweenOrderByDateAsc(site: Site, person: Person, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
fun findBySiteAndPersonAndDateBetweenOrderByDateAsc(site: Site, person: Person, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
||||||
|
|
||||||
fun findBySiteAndWhomIgnoreCaseAndPersonAndDateBetweenOrderByDateAsc(site: Site, whom: String, person: Person, startDate: LocalDate, endDate: LocalDate): List<Observation>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -112,11 +112,11 @@ class ControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGetObservations_WithSite_TutorNull_NoWhom() {
|
fun testGetObservations_WithSite_TutorNull() {
|
||||||
val request = ObservationsRequest(1, null, "", "", LocalDate.now(), LocalDate.now())
|
val request = ObservationsRequest(1, null, "", "", LocalDate.now(), LocalDate.now())
|
||||||
val site = Site(1, "Area 51")
|
val site = Site(1, "Area 51")
|
||||||
val observation = Observation(site = site, date = LocalDate.now(),
|
val observation = Observation(site = site, date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
type = TrainingType.INITIAL, observed = "1", monitoring = 5.0, controlProcedural = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(), person = Person(name = "noone"))
|
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(), person = Person(name = "noone"))
|
||||||
doReturn(Optional.of(site)).`when`(siteRepository).findById(1)
|
doReturn(Optional.of(site)).`when`(siteRepository).findById(1)
|
||||||
@ -128,28 +128,12 @@ class ControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGetObservations_WithSite_TutorNull_WithWhom() {
|
fun testGetObservations_WithSite_WithTutor() {
|
||||||
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, controlProcedural = 3.0,
|
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(), person = Person(name = "noone"))
|
|
||||||
doReturn(Optional.of(site)).`when`(siteRepository).findById(1)
|
|
||||||
doReturn(listOf(observation))
|
|
||||||
.`when`(observationRepository).findBySiteAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(site, "Group A", LocalDate.now(), LocalDate.now())
|
|
||||||
val result = controller.getObservations(request)
|
|
||||||
assertEquals(1, result.size)
|
|
||||||
assertEquals(observation, result[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testGetObservations_WithSite_WithTutor_NoWhom() {
|
|
||||||
val request = ObservationsRequest(null, 1, "", "", LocalDate.now(), LocalDate.now())
|
val request = ObservationsRequest(null, 1, "", "", LocalDate.now(), LocalDate.now())
|
||||||
val site = Site(1, "Area 51")
|
val site = Site(1, "Area 51")
|
||||||
val tutor = Tutor(1, "Mr Unknown", site)
|
val tutor = Tutor(1, "Mr Unknown", site)
|
||||||
val observation = Observation(site = site, date = LocalDate.now(),
|
val observation = Observation(site = site, date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "G1", monitoring = 5.0, controlProcedural = 3.0,
|
type = TrainingType.INITIAL, observed = "1", monitoring = 5.0, controlProcedural = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(tutor), person = Person(name = "noone"))
|
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(tutor), person = Person(name = "noone"))
|
||||||
doReturn(Optional.of(tutor)).`when`(tutorRepository).findById(1)
|
doReturn(Optional.of(tutor)).`when`(tutorRepository).findById(1)
|
||||||
@ -160,23 +144,6 @@ class ControllerTest {
|
|||||||
assertEquals(observation, result[0])
|
assertEquals(observation, result[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testGetObservations_WithSite_WithTutor_WithWhom() {
|
|
||||||
val request = ObservationsRequest(null, 1, "Group A", "", LocalDate.now(), LocalDate.now())
|
|
||||||
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, controlProcedural = 3.0,
|
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(tutor), person = Person(name = "noone"))
|
|
||||||
doReturn(Optional.of(tutor)).`when`(tutorRepository).findById(1)
|
|
||||||
doReturn(listOf(observation))
|
|
||||||
.`when`(observationRepository).findByTutorsAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(tutor, "Group A", LocalDate.now(), LocalDate.now())
|
|
||||||
val result = controller.getObservations(request)
|
|
||||||
assertEquals(1, result.size)
|
|
||||||
assertEquals(observation, result[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testGetObservations_WithPerson() {
|
fun testGetObservations_WithPerson() {
|
||||||
val request = ObservationsRequest(1, null, null, "Foo Bar", LocalDate.now(), LocalDate.now())
|
val request = ObservationsRequest(1, null, null, "Foo Bar", LocalDate.now(), LocalDate.now())
|
||||||
@ -184,7 +151,7 @@ class ControllerTest {
|
|||||||
val tutor = Tutor(1, "Mr Unknown", site)
|
val tutor = Tutor(1, "Mr Unknown", site)
|
||||||
val person = Person(1, "Foo Bar")
|
val person = Person(1, "Foo Bar")
|
||||||
val observation = Observation(site = site, date = LocalDate.now(),
|
val observation = Observation(site = site, date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL, observed = "1", whom = "Group A", monitoring = 5.0, controlProcedural = 3.0,
|
type = TrainingType.INITIAL, observed = "1", monitoring = 5.0, controlProcedural = 3.0,
|
||||||
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
control = 4.0, conservatism = 3.0, teamworkCommunications = 2.0, teamworkLeadership = 3.0,
|
||||||
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(tutor), person = person)
|
teamworkWorkload = 1.0, knowledge = 1.0, scenarios = listOf(), tutors = setOf(tutor), person = person)
|
||||||
doReturn(Optional.of(site)).`when`(siteRepository).findById(1)
|
doReturn(Optional.of(site)).`when`(siteRepository).findById(1)
|
||||||
|
@ -31,15 +31,6 @@ class RepositoryTest {
|
|||||||
assertTrue(result.isEmpty())
|
assertTrue(result.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testFindBySiteAndWhomIgnoreCaseAndDateBetween_EmptyRepository() {
|
|
||||||
val result = observationRepository.findBySiteAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(Site(
|
|
||||||
id = 1,
|
|
||||||
name = "x"
|
|
||||||
), "none", LocalDate.now(), LocalDate.now())
|
|
||||||
assertTrue(result.isEmpty())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindByTutorsAndDateBetween_EmptyRepository() {
|
fun testFindByTutorsAndDateBetween_EmptyRepository() {
|
||||||
val result = observationRepository.findByTutorsAndDateBetweenOrderByDateAsc(Tutor(
|
val result = observationRepository.findByTutorsAndDateBetweenOrderByDateAsc(Tutor(
|
||||||
@ -50,16 +41,6 @@ class RepositoryTest {
|
|||||||
assertTrue(result.isEmpty())
|
assertTrue(result.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testFindByTutorsAndWhomIgnoreCaseAndDateBetween_EmptyRepository() {
|
|
||||||
val result = observationRepository.findByTutorsAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(Tutor(
|
|
||||||
id = 1,
|
|
||||||
name = "x",
|
|
||||||
site = Site(1, "x")
|
|
||||||
), "none", LocalDate.now(), LocalDate.now())
|
|
||||||
assertTrue(result.isEmpty())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindBySiteAndDateBetween() {
|
fun testFindBySiteAndDateBetween() {
|
||||||
val correctSite = entityManager.persist(Site(name = "Correct"))
|
val correctSite = entityManager.persist(Site(name = "Correct"))
|
||||||
@ -72,7 +53,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now().minusDays(5),
|
date = LocalDate.now().minusDays(5),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -90,7 +70,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now().plusDays(5),
|
date = LocalDate.now().plusDays(5),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -108,7 +87,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -126,7 +104,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -152,118 +129,6 @@ class RepositoryTest {
|
|||||||
assertEquals(justRight, result.first())
|
assertEquals(justRight, result.first())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testFindBySiteAndWhomIgnoreCaseAndDateBetween() {
|
|
||||||
val correctSite = entityManager.persist(Site(name = "Correct"))
|
|
||||||
val incorrectSite = entityManager.persist(Site(name = "Incorrect"))
|
|
||||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
|
||||||
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,
|
|
||||||
controlProcedural = 3.0,
|
|
||||||
control = 4.0,
|
|
||||||
conservatism = 3.0,
|
|
||||||
teamworkCommunications = 2.0,
|
|
||||||
teamworkLeadership = 3.0,
|
|
||||||
teamworkWorkload = 1.0,
|
|
||||||
knowledge = 1.0,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(tutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val tooLate = Observation(
|
|
||||||
site = correctSite,
|
|
||||||
date = LocalDate.now().plusDays(5),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(tutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val wrongSite = Observation(
|
|
||||||
site = incorrectSite,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(tutor2),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val justRight = Observation(
|
|
||||||
site = correctSite,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(tutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val wrongWhom = Observation(
|
|
||||||
site = correctSite,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(tutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
entityManager.persist(tooEarly)
|
|
||||||
entityManager.persist(tooLate)
|
|
||||||
entityManager.persist(wrongSite)
|
|
||||||
entityManager.persist(justRight)
|
|
||||||
entityManager.persist(wrongWhom)
|
|
||||||
val result = observationRepository.findBySiteAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(
|
|
||||||
site = correctSite,
|
|
||||||
startDate = LocalDate.now().minusDays(1),
|
|
||||||
endDate = LocalDate.now().plusDays(1),
|
|
||||||
whom = "G1"
|
|
||||||
)
|
|
||||||
assertEquals(1, result.size)
|
|
||||||
assertEquals(justRight, result.first())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindByTutorsAndDateBetween() {
|
fun testFindByTutorsAndDateBetween() {
|
||||||
val site = entityManager.persist(Site(name = "Correct"))
|
val site = entityManager.persist(Site(name = "Correct"))
|
||||||
@ -275,7 +140,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now().minusDays(5),
|
date = LocalDate.now().minusDays(5),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -293,7 +157,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now().plusDays(5),
|
date = LocalDate.now().plusDays(5),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -311,7 +174,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -329,7 +191,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -347,7 +208,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -380,143 +240,6 @@ class RepositoryTest {
|
|||||||
assertFalse(result.contains(wrongTutor))
|
assertFalse(result.contains(wrongTutor))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testFindByTutorsAndWhomIgnoreCaseAndDateBetween() {
|
|
||||||
val site = entityManager.persist(Site(name = "Correct"))
|
|
||||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
|
||||||
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,
|
|
||||||
controlProcedural = 3.0,
|
|
||||||
control = 4.0,
|
|
||||||
conservatism = 3.0,
|
|
||||||
teamworkCommunications = 2.0,
|
|
||||||
teamworkLeadership = 3.0,
|
|
||||||
teamworkWorkload = 1.0,
|
|
||||||
knowledge = 1.0,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(correctTutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val tooLate = Observation(
|
|
||||||
site = site,
|
|
||||||
date = LocalDate.now().plusDays(5),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(correctTutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val wrongTutor = Observation(
|
|
||||||
site = site,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(incorrectTutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val justRight = Observation(
|
|
||||||
site = site,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(correctTutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val wrongGroup = Observation(
|
|
||||||
site = site,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(correctTutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
val justRightMultipleTutors = Observation(
|
|
||||||
site = site,
|
|
||||||
date = LocalDate.now(),
|
|
||||||
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,
|
|
||||||
scenarios = listOf(),
|
|
||||||
tutors = setOf(correctTutor, incorrectTutor),
|
|
||||||
person = person
|
|
||||||
)
|
|
||||||
entityManager.persist(tooEarly)
|
|
||||||
entityManager.persist(tooLate)
|
|
||||||
entityManager.persist(wrongTutor)
|
|
||||||
entityManager.persist(justRight)
|
|
||||||
entityManager.persist(wrongGroup)
|
|
||||||
entityManager.persist(justRightMultipleTutors)
|
|
||||||
correctTutor.observations.addAll(listOf(tooEarly, tooLate, justRight, justRightMultipleTutors, wrongGroup))
|
|
||||||
entityManager.persist(correctTutor)
|
|
||||||
incorrectTutor.observations.addAll(listOf(wrongTutor, justRightMultipleTutors))
|
|
||||||
entityManager.persist(incorrectTutor)
|
|
||||||
val result = observationRepository.findByTutorsAndWhomIgnoreCaseAndDateBetweenOrderByDateAsc(
|
|
||||||
tutor = correctTutor,
|
|
||||||
startDate = LocalDate.now().minusDays(1),
|
|
||||||
endDate = LocalDate.now().plusDays(1),
|
|
||||||
whom = "G1"
|
|
||||||
)
|
|
||||||
assertEquals(2, result.size)
|
|
||||||
assertTrue(result.contains(justRight))
|
|
||||||
assertTrue(result.contains(justRightMultipleTutors))
|
|
||||||
assertFalse(result.contains(wrongTutor))
|
|
||||||
assertFalse(result.contains(wrongGroup))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFindBySiteAndPersonsAndDateBetween() {
|
fun testFindBySiteAndPersonsAndDateBetween() {
|
||||||
val person = entityManager.persist(Person(name = "Foo Bar"))
|
val person = entityManager.persist(Person(name = "Foo Bar"))
|
||||||
@ -528,7 +251,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now().minusDays(5),
|
date = LocalDate.now().minusDays(5),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -546,7 +268,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now().plusDays(5),
|
date = LocalDate.now().plusDays(5),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -564,7 +285,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
@ -582,7 +302,6 @@ class RepositoryTest {
|
|||||||
date = LocalDate.now(),
|
date = LocalDate.now(),
|
||||||
type = TrainingType.INITIAL,
|
type = TrainingType.INITIAL,
|
||||||
observed = "1",
|
observed = "1",
|
||||||
whom = "G1",
|
|
||||||
monitoring = 5.0,
|
monitoring = 5.0,
|
||||||
controlProcedural = 3.0,
|
controlProcedural = 3.0,
|
||||||
control = 4.0,
|
control = 4.0,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<b-container fluid>
|
<b-container fluid>
|
||||||
<!-- <b-container v-if="description != null && type != null && whom != null && site != null && tutors != null" fluid style="padding-left: 130px;"> -->
|
<!-- <b-container type != null && whom != null && site != null && tutors != null" fluid style="padding-left: 130px;"> -->
|
||||||
<b-container fluid style="padding-left: 130px;">
|
<b-container fluid style="padding-left: 130px;">
|
||||||
<h3>
|
<h3>
|
||||||
<v-icon name="tag" scale="1.5"/>
|
<v-icon name="tag" scale="1.5"/>
|
||||||
@ -324,7 +324,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["description", "type", "whom", "site", "tutors"])
|
...mapState(["type", "whom", "site", "tutors"])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addAnotherObservation: function() {
|
addAnotherObservation: function() {
|
||||||
@ -468,8 +468,9 @@ export default {
|
|||||||
{
|
{
|
||||||
site: this.site,
|
site: this.site,
|
||||||
tutors: this.tutors,
|
tutors: this.tutors,
|
||||||
whom: this.whom,
|
person: this.whom,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
|
observed: this.scenarios.map(x => x.title).join(', '),
|
||||||
scenarios: JSON.parse(JSON.stringify(this.scenarios))
|
scenarios: JSON.parse(JSON.stringify(this.scenarios))
|
||||||
},
|
},
|
||||||
axiosConfig
|
axiosConfig
|
||||||
|
@ -112,7 +112,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["site", "description", "type", "tutors", "whom"])
|
...mapState(["site", "type", "tutors", "whom"])
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
site: function() {
|
site: function() {
|
||||||
@ -130,7 +130,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations([
|
...mapMutations([
|
||||||
"setSite",
|
"setSite",
|
||||||
"setDescription",
|
|
||||||
"setType",
|
"setType",
|
||||||
"setTutors",
|
"setTutors",
|
||||||
"setWhom",
|
"setWhom",
|
||||||
|
@ -1,139 +1,196 @@
|
|||||||
<template>
|
<template>
|
||||||
<b-container fluid>
|
<b-container fluid>
|
||||||
<b-modal ref="errorModal" class="text-center" centered hide-header hide-footer>
|
<b-modal ref="errorModal" class="text-center" centered hide-header hide-footer>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3 class="modal-title w-100">{{ errorStatus }}</h3>
|
<h3 class="modal-title w-100">{{ errorStatus }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-block">
|
<div class="d-block">
|
||||||
<br/>
|
<br>
|
||||||
<span style="font-size:20px;" v-html="errorMessage"/>
|
<span style="font-size:20px;" v-html="errorMessage"/>
|
||||||
<button class="btn btn-warning" @click="$refs.errorModal.hide()">
|
<button class="btn btn-warning" @click="$refs.errorModal.hide()">
|
||||||
<v-icon name="exclamation-circle"/>
|
<v-icon name="exclamation-circle"/>Dismiss
|
||||||
Dismiss
|
</button>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
</b-modal>
|
||||||
</b-modal>
|
<b-row>
|
||||||
<b-row>
|
<b-col>
|
||||||
<b-col>
|
<b-form-group label="Site">
|
||||||
<b-form-group label="Site">
|
<b-form-select class="text-center" v-model="siteSelection" :options="siteOptions"/>
|
||||||
<b-form-select class="text-center" v-model="siteSelection"
|
</b-form-group>
|
||||||
:options="siteOptions"/>
|
</b-col>
|
||||||
</b-form-group>
|
<b-col>
|
||||||
</b-col>
|
<b-form-group label="Tutor">
|
||||||
<b-col>
|
<b-form-select class="text-center" v-model="tutorSelection" :options="tutorOptions"/>
|
||||||
<b-form-group label="Tutor">
|
</b-form-group>
|
||||||
<b-form-select class="text-center" v-model="tutorSelection"
|
</b-col>
|
||||||
:options="tutorOptions"/>
|
<b-col>
|
||||||
</b-form-group>
|
<b-form-group label="Shift">
|
||||||
</b-col>
|
<b-form-input v-model="whom" type="text" class="text-center"></b-form-input>
|
||||||
<b-col>
|
</b-form-group>
|
||||||
<b-form-group label="Shift">
|
</b-col>
|
||||||
<b-form-input v-model="whom" type="text" class="text-center"></b-form-input>
|
<b-col>
|
||||||
</b-form-group>
|
<b-form-group label="Person">
|
||||||
</b-col>
|
<b-form-input v-model="person" type="text" class="text-center"></b-form-input>
|
||||||
<b-col>
|
</b-form-group>
|
||||||
<b-form-group label="Person">
|
</b-col>
|
||||||
<b-form-input v-model="person" type="text" class="text-center"></b-form-input>
|
<b-col>
|
||||||
</b-form-group>
|
<b-form-group label="From">
|
||||||
</b-col>
|
<date-picker
|
||||||
<b-col>
|
v-model="startDate"
|
||||||
<b-form-group label="From">
|
@dp-change="changeStartDate"
|
||||||
<date-picker v-model="startDate" @dp-change="changeStartDate" value="startDate"
|
value="startDate"
|
||||||
:config="dateOptions"/>
|
:config="dateOptions"
|
||||||
</b-form-group>
|
/>
|
||||||
</b-col>
|
</b-form-group>
|
||||||
<b-col>
|
</b-col>
|
||||||
<b-form-group label="To">
|
<b-col>
|
||||||
<date-picker v-model="endDate" @dp-change="changeEndDate" value="endDate"
|
<b-form-group label="To">
|
||||||
:config="dateOptions"/>
|
<date-picker
|
||||||
</b-form-group>
|
v-model="endDate"
|
||||||
</b-col>
|
@dp-change="changeEndDate"
|
||||||
<b-col>
|
value="endDate"
|
||||||
<b-button v-on:click="getFiltered()">Refresh</b-button>
|
:config="dateOptions"
|
||||||
</b-col>
|
/>
|
||||||
</b-row>
|
</b-form-group>
|
||||||
<b-container v-if="observationData != null && observationData.length > 0" fluid>
|
</b-col>
|
||||||
<b-card no-body>
|
<b-col>
|
||||||
<b-tabs pills card vertical>
|
<b-button v-on:click="getFiltered()">Refresh</b-button>
|
||||||
<b-tab v-for="(observation, index) in observationData" v-bind:key="index">
|
</b-col>
|
||||||
<p slot="title">{{ observation.date }}<br/>{{ observation.whom }} {{ observation.type }}<br/>{{ shortenedString(observation.observed) }}</p>
|
</b-row>
|
||||||
<h2>{{ observation.date }}, {{ observation.whom }}<br/>{{ observation.type }}, {{ observation.observed }}</h2>
|
<b-container v-if="observationData != null && observationData.length > 0" fluid>
|
||||||
<b-row align-h="center">
|
<b-card no-body>
|
||||||
<h4>Observed by: <span v-bind:key="index" v-for="(tutor, index) in observation.tutors"><i>{{ tutor.name }}<span v-if="index+1 < observation.tutors.length">, </span></i></span></h4>
|
<b-tabs pills card vertical>
|
||||||
</b-row>
|
<b-tab v-for="(observation, index) in observationData" v-bind:key="index">
|
||||||
<b-row align-h="center">
|
<p slot="title">
|
||||||
<h4>Participants: <span v-bind:key="index" v-for="(person, index) in observation.persons"><i>{{ person.name }}<span v-if="index+1 < observation.persons.length">, </span></i></span></h4>
|
{{ observation.date }}
|
||||||
</b-row>
|
<br>
|
||||||
<br />
|
{{ observation.whom }} {{ observation.type }}
|
||||||
<b-row class="mb-2">
|
<br>
|
||||||
<b-col class="centered-image" v-if="observation.monitoring">
|
{{ shortenedString(observation.observed) }}
|
||||||
<img src="../assets/Monitoring.svg" class="image-opacity"/>
|
</p>
|
||||||
<div class="image-centered-text">{{ observation.monitoring.toFixed(1) }}</div>
|
<h2>
|
||||||
</b-col>
|
{{ observation.date }}, {{ observation.whom }}
|
||||||
<b-col class="centered-image" v-if="observation.controlProcedural">
|
<br>
|
||||||
<img src="../assets/Control.svg" class="image-opacity"/>
|
{{ observation.type }} / {{ observation.observed }}
|
||||||
<div class="image-centered-text">{{ observation.controlProcedural.toFixed(1) }}</div>
|
</h2>
|
||||||
</b-col>
|
<b-row align-h="center">
|
||||||
<b-col class="centered-image" v-if="observation.control">
|
<h4>Observed by:
|
||||||
<img src="../assets/Control.svg" class="image-opacity"/>
|
<span v-bind:key="index" v-for="(tutor, index) in observation.tutors">
|
||||||
<div class="image-centered-text">{{ observation.control.toFixed(1) }}</div>
|
<i>
|
||||||
</b-col>
|
{{ tutor.name }}
|
||||||
<b-col class="centered-image" v-if="observation.conservatism">
|
<span v-if="index+1 < observation.tutors.length">, </span>
|
||||||
<img src="../assets/Conservatism.svg" class="image-opacity"/>
|
</i>
|
||||||
<div class="image-centered-text">{{ observation.conservatism.toFixed(1) }}</div>
|
</span>
|
||||||
</b-col>
|
</h4>
|
||||||
<b-col class="centered-image" v-if="observation.teamworkCommunications">
|
|
||||||
<img src="../assets/Teamwork.svg" class="image-opacity"/>
|
|
||||||
<div class="image-centered-text">{{ observation.teamworkCommunications.toFixed(1) }}</div>
|
|
||||||
</b-col>
|
|
||||||
<b-col class="centered-image" v-if="observation.teamworkLeadership">
|
|
||||||
<img src="../assets/Teamwork.svg" class="image-opacity"/>
|
|
||||||
<div class="image-centered-text">{{ observation.teamworkLeadership.toFixed(1) }}</div>
|
|
||||||
</b-col>
|
|
||||||
<b-col class="centered-image" v-if="observation.teamworkWorkload">
|
|
||||||
<img src="../assets/Teamwork.svg" class="image-opacity"/>
|
|
||||||
<div class="image-centered-text">{{ observation.teamworkWorkload.toFixed(1) }}</div>
|
|
||||||
</b-col>
|
|
||||||
<b-col class="centered-image" v-if="observation.knowledge">
|
|
||||||
<img src="../assets/Knowledge.svg" class="image-opacity"/>
|
|
||||||
<div class="image-centered-text">{{ observation.knowledge.toFixed(1) }}</div>
|
|
||||||
</b-col>
|
|
||||||
</b-row>
|
|
||||||
<div v-for="(entry, index2) in observation.entries" v-bind:key="index2">
|
|
||||||
<p>{{ entry.type }} - {{ entry.rating }}</p>
|
|
||||||
<b-form-group label="Strengths">
|
|
||||||
<b-form-textarea :value="entry.strengths" readonly>
|
|
||||||
</b-form-textarea>
|
|
||||||
</b-form-group>
|
|
||||||
<b-form-group label="Areas of Improvement">
|
|
||||||
<b-form-textarea :value="entry.improvements" readonly>
|
|
||||||
</b-form-textarea>
|
|
||||||
</b-form-group>
|
|
||||||
</div>
|
|
||||||
</b-tab>
|
|
||||||
</b-tabs>
|
|
||||||
</b-card>
|
|
||||||
<b-button class="mt-2" variant="success" @click="getCSV()">CSV Dump</b-button>
|
|
||||||
</b-container>
|
|
||||||
<b-container v-else>
|
|
||||||
<b-row>
|
|
||||||
<b-col>
|
|
||||||
<v-icon name="search"></v-icon>
|
|
||||||
<p>No data found with the given search parameters.</p>
|
|
||||||
</b-col>
|
|
||||||
</b-row>
|
</b-row>
|
||||||
</b-container>
|
<b-row align-h="center">
|
||||||
|
<h4>Participant: {{ observation.person.name }}</h4>
|
||||||
|
</b-row>
|
||||||
|
<br>
|
||||||
|
<b-row class="mb-2">
|
||||||
|
<b-col class="centered-image" v-if="observation.monitoring">
|
||||||
|
<img src="../assets/Monitoring.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.monitoring < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.monitoring.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.controlProcedural">
|
||||||
|
<img src="../assets/Control.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.controlProcedural < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.controlProcedural.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.control">
|
||||||
|
<img src="../assets/Control.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.control < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.control.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.conservatism">
|
||||||
|
<img src="../assets/Conservatism.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.conservatism < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.conservatism.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.teamworkCommunications">
|
||||||
|
<img src="../assets/Teamwork.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.teamworkCommunications < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.teamworkCommunications.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.teamworkLeadership">
|
||||||
|
<img src="../assets/Teamwork.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.teamworkLeadership < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.teamworkLeadership.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.teamworkWorkload">
|
||||||
|
<img src="../assets/Teamwork.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.teamworkWorkload < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.teamworkWorkload.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
<b-col class="centered-image" v-if="observation.knowledge">
|
||||||
|
<img src="../assets/Knowledge.svg" class="image-opacity" v-bind:class="{ scorewarning: observation.knowledge < 2.5 }">
|
||||||
|
<div class="image-centered-text">{{ observation.knowledge.toFixed(1) }}</div>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
<b-row v-for="(entry, index2) in observation.scenarios" v-bind:key="index2">
|
||||||
|
<b-col class="border">
|
||||||
|
<b-row align-h="center">
|
||||||
|
<h3>{{ entry.title }}</h3>
|
||||||
|
</b-row>
|
||||||
|
<b-row>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.monitoring"
|
||||||
|
:description="'Monitoring'"
|
||||||
|
></observation-entry>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.controlProcedural"
|
||||||
|
:description="'Control Procedural'"
|
||||||
|
></observation-entry>
|
||||||
|
</b-row>
|
||||||
|
<b-row>
|
||||||
|
<observation-entry :scenariofundamental="entry.control" :description="'Control'"></observation-entry>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.conservatism"
|
||||||
|
:description="'Conservatism'"
|
||||||
|
></observation-entry>
|
||||||
|
</b-row>
|
||||||
|
<b-row>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.teamworkCommunications"
|
||||||
|
:description="'Teamwork Communications'"
|
||||||
|
></observation-entry>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.teamworkLeadership"
|
||||||
|
:description="'Teamwork Leadership'"
|
||||||
|
></observation-entry>
|
||||||
|
</b-row>
|
||||||
|
<b-row>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.teamworkWorkload"
|
||||||
|
:description="'Teamwork Workload'"
|
||||||
|
></observation-entry>
|
||||||
|
<observation-entry
|
||||||
|
:scenariofundamental="entry.knowledge"
|
||||||
|
:description="'Knowledge'"
|
||||||
|
></observation-entry>
|
||||||
|
</b-row>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
</b-tab>
|
||||||
|
</b-tabs>
|
||||||
|
</b-card>
|
||||||
|
<b-button class="mt-2" variant="success" @click="getCSV()">CSV Dump</b-button>
|
||||||
</b-container>
|
</b-container>
|
||||||
|
<b-container v-else>
|
||||||
|
<b-row>
|
||||||
|
<b-col>
|
||||||
|
<v-icon name="search"></v-icon>
|
||||||
|
<p>No data found with the given search parameters.</p>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
</b-container>
|
||||||
|
</b-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import "vue-awesome/icons/search";
|
import "vue-awesome/icons/search";
|
||||||
|
import ObservationEntry from "../components/ObservationEntry.vue";
|
||||||
|
|
||||||
var moment = require("moment");
|
var moment = require("moment");
|
||||||
export default {
|
export default {
|
||||||
name: "viewobservations",
|
name: "viewobservations",
|
||||||
title: "Observations History",
|
title: "Observations History",
|
||||||
|
components: { ObservationEntry },
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
dateOptions: {
|
dateOptions: {
|
||||||
@ -158,58 +215,57 @@ export default {
|
|||||||
this.$router.push("/dberror");
|
this.$router.push("/dberror");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(error);
|
|
||||||
});
|
});
|
||||||
this.getTutors();
|
this.getTutors();
|
||||||
this.getFiltered();
|
this.getFiltered();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
startDate: {
|
startDate: {
|
||||||
get(){
|
get() {
|
||||||
return this.$store.state.search.start;
|
return this.$store.state.search.start;
|
||||||
},
|
},
|
||||||
set(data){
|
set(data) {
|
||||||
this.$store.commit('setSearchStartDate', data);
|
this.$store.commit("setSearchStartDate", data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endDate: {
|
endDate: {
|
||||||
get(){
|
get() {
|
||||||
return this.$store.state.search.end;
|
return this.$store.state.search.end;
|
||||||
},
|
},
|
||||||
set(data){
|
set(data) {
|
||||||
this.$store.commit('setSearchEndDate', data);
|
this.$store.commit("setSearchEndDate", data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
siteSelection: {
|
siteSelection: {
|
||||||
get(){
|
get() {
|
||||||
return this.$store.state.search.site;
|
return this.$store.state.search.site;
|
||||||
},
|
},
|
||||||
set(data){
|
set(data) {
|
||||||
this.$store.commit('setSearchSite', data);
|
this.$store.commit("setSearchSite", data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tutorSelection: {
|
tutorSelection: {
|
||||||
get(){
|
get() {
|
||||||
return this.$store.state.search.tutor;
|
return this.$store.state.search.tutor;
|
||||||
},
|
},
|
||||||
set(data){
|
set(data) {
|
||||||
this.$store.commit('setSearchTutor', data)
|
this.$store.commit("setSearchTutor", data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
whom: {
|
whom: {
|
||||||
get(){
|
get() {
|
||||||
return this.$store.state.search.whom;
|
return this.$store.state.search.whom;
|
||||||
},
|
},
|
||||||
set(data){
|
set(data) {
|
||||||
this.$store.commit('setSearchWhom', data)
|
this.$store.commit("setSearchWhom", data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
person: {
|
person: {
|
||||||
get(){
|
get() {
|
||||||
return this.$store.state.search.person;
|
return this.$store.state.search.person;
|
||||||
},
|
},
|
||||||
set(data){
|
set(data) {
|
||||||
this.$store.commit('setSearchPerson', data)
|
this.$store.commit("setSearchPerson", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -276,12 +332,11 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
shortenedString: function(data) {
|
shortenedString: function(data) {
|
||||||
if(data.len < 20){
|
if (data.len < 20) {
|
||||||
return data;
|
return data;
|
||||||
}
|
} else {
|
||||||
else{
|
return data.substr(0, 20) + "...";
|
||||||
return data.substr(0, 20) + "...";
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -302,6 +357,9 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.scorewarning {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
.image-centered-text {
|
.image-centered-text {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
Loading…
Reference in New Issue
Block a user