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 6406868..7171742 100644 --- a/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt +++ b/backend/src/main/kotlin/uk/co/neviyn/observationdatabase/Entity.kt @@ -122,7 +122,11 @@ data class RatingComponent( val rating: Int, val strengths: String = "", val improvements: String = "" -) +) { + fun ratingValid(): Boolean { + return rating in 1..5 + } +} @Entity data class Scenario( @@ -149,15 +153,14 @@ data class Scenario( ) { fun ratingsAllValid(): Boolean { - val limitation = 1..5 - return monitoring.rating in limitation && - controlProcedural.rating in limitation && - control.rating in limitation && - conservatism.rating in limitation && - teamworkCommunications.rating in limitation && - teamworkLeadership.rating in limitation && - teamworkWorkload.rating in limitation && - knowledge.rating in limitation + return monitoring.ratingValid() && + controlProcedural.ratingValid()&& + control.ratingValid() && + conservatism.ratingValid() && + teamworkCommunications.ratingValid() && + teamworkLeadership.ratingValid() && + teamworkWorkload.ratingValid() && + knowledge.ratingValid() } }