Improved Javadoc
This commit is contained in:
parent
e70567d1a8
commit
93b0f68721
@ -1,5 +1,8 @@
|
||||
package uk.co.neviyn.observationdatabase
|
||||
|
||||
/**
|
||||
* Header line for a CSV file in the format of the standard observation database
|
||||
*/
|
||||
fun csvHeaderString(): String {
|
||||
return "Ob ID,Observerfull,Observer,obDate,Title,Type,Department,Station,Station Focus,Scores-Monitoring,Scores-Control Procedural," +
|
||||
"Scores-Control,Scores-Conservatism,Scores-Teamwork Comms,Scores-Teamwork Leadership,Scores-Teamwork Workload,\"Scores-Knowledge, Skills and Attitudes\"," +
|
||||
@ -9,6 +12,9 @@ fun csvHeaderString(): String {
|
||||
"Develop-Teamwork Leadership,Develop-Teamwork Workload,\"Develop-Knowledge, Skills and Attitudes\""
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the observations in [data], output a string that aligns the data with the format described in csvHeaderString()
|
||||
*/
|
||||
fun observationsToCSV(data: List<Observation>): String {
|
||||
val builder = StringBuilder(csvHeaderString())
|
||||
data.forEach {
|
||||
|
@ -17,6 +17,9 @@ class Email {
|
||||
|
||||
private val logger: Logger = LoggerFactory.getLogger(javaClass)!!
|
||||
|
||||
/**
|
||||
* Send observation data to the configured email address
|
||||
*/
|
||||
fun sendObservationData(observations: List<Observation>) {
|
||||
if (observations.isEmpty()) {
|
||||
logger.error("Cannot send observations email containing no observations!")
|
||||
|
@ -17,6 +17,9 @@ object GroupSessionManager {
|
||||
var scenarioTitles: List<String>? = null
|
||||
var observations: MutableMap<String, GroupObservation> = mutableMapOf()
|
||||
|
||||
/**
|
||||
* Start a new group session
|
||||
*/
|
||||
fun startNewSession(site: Site, tutors: Set<Tutor>, trainingType: TrainingType, scenarioTitles: List<String>): Int {
|
||||
logger.info("Starting new Group Session")
|
||||
logger.debug("Previous ID was $sessionId")
|
||||
@ -34,6 +37,9 @@ object GroupSessionManager {
|
||||
return sessionId
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate the current session
|
||||
*/
|
||||
fun invalidate() {
|
||||
this.site = null
|
||||
this.tutors = null
|
||||
@ -42,14 +48,23 @@ object GroupSessionManager {
|
||||
this.observations = mutableMapOf()
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current session has [sessionId] and is valid
|
||||
*/
|
||||
fun isValid(sessionId: Int): Boolean {
|
||||
return isValid() && sessionId == this.sessionId
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current session is valid
|
||||
*/
|
||||
fun isValid(): Boolean {
|
||||
return site != null && tutors != null && trainingType != null && scenarioTitles != null
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data contained in the current session in the scenario format
|
||||
*/
|
||||
fun asScenarioView(): MutableMap<String, MutableList<Scenario>> {
|
||||
val output: MutableMap<String, MutableList<Scenario>> = mutableMapOf()
|
||||
scenarioTitles?.forEach { title ->
|
||||
@ -63,6 +78,9 @@ object GroupSessionManager {
|
||||
return output
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the data currently submitted for a session is all valid
|
||||
*/
|
||||
fun dataComplete(): Boolean {
|
||||
if (observations.isEmpty()) {
|
||||
logger.warn("Observations is currently empty")
|
||||
@ -77,11 +95,20 @@ object GroupSessionManager {
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the stored data for the individual submitting the [input] data
|
||||
*/
|
||||
fun updateObservationData(input: GroupObservation) {
|
||||
observations[input.person] = input
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether [name] exists as a participant in this session
|
||||
*/
|
||||
fun participantExistsInSession(name: String): Boolean = observations.containsKey(name)
|
||||
|
||||
/**
|
||||
* Get the observation data stored in this session for [name]
|
||||
*/
|
||||
fun getObservationDataForParticipant(name: String): GroupObservation? = observations[name]
|
||||
}
|
Loading…
Reference in New Issue
Block a user