net.nemerosa.ontrack.model.support.ConnectorGlobalStatus.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-model Show documentation
Show all versions of ontrack-model Show documentation
Ontrack module: ontrack-model
package net.nemerosa.ontrack.model.support
import kotlin.math.roundToInt
class ConnectorGlobalStatus(
val statuses: List
) {
val count = statuses.size
val upCount = statuses.count { it.status.type == ConnectorStatusType.UP }
val downCount = statuses.count { it.status.type == ConnectorStatusType.DOWN }
val status: ConnectorStatusType = if (downCount > 0) ConnectorStatusType.DOWN else ConnectorStatusType.UP
val percent: Int = if (count > 0) {
(upCount.toDouble() * 100.0 / count).roundToInt()
} else {
100
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy