Simplified rating validity check

This commit is contained in:
neviyn 2019-03-05 11:42:54 +00:00
parent 4e81e9a5b9
commit 0ec96a874d

View File

@ -122,7 +122,11 @@ data class RatingComponent(
val rating: Int, val rating: Int,
val strengths: String = "", val strengths: String = "",
val improvements: String = "" val improvements: String = ""
) ) {
fun ratingValid(): Boolean {
return rating in 1..5
}
}
@Entity @Entity
data class Scenario( data class Scenario(
@ -149,15 +153,14 @@ data class Scenario(
) { ) {
fun ratingsAllValid(): Boolean { fun ratingsAllValid(): Boolean {
val limitation = 1..5 return monitoring.ratingValid() &&
return monitoring.rating in limitation && controlProcedural.ratingValid()&&
controlProcedural.rating in limitation && control.ratingValid() &&
control.rating in limitation && conservatism.ratingValid() &&
conservatism.rating in limitation && teamworkCommunications.ratingValid() &&
teamworkCommunications.rating in limitation && teamworkLeadership.ratingValid() &&
teamworkLeadership.rating in limitation && teamworkWorkload.ratingValid() &&
teamworkWorkload.rating in limitation && knowledge.ratingValid()
knowledge.rating in limitation
} }
} }