You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
766 B

package net.aiterp.git.ykonsole2.domain.models
import net.aiterp.git.ykonsole2.domain.runtime.Time
import net.aiterp.git.ykonsole2.domain.runtime.Value
import net.aiterp.git.ykonsole2.domain.runtime.find
import java.time.Instant
data class Workout(
val id: String = randomId(),
val createdAt: Instant = Instant.now(),
val deviceId: String = "",
val programId: String? = null,
var status: WorkoutStatus = WorkoutStatus.Created,
var message: String = "",
var test: Boolean = false,
) {
fun makeState(values: Collection<Value>) = WorkoutState(
workoutId = id,
time = values.find() ?: Time(0),
calories = values.find(),
level = values.find(),
distance = values.find(),
rpmSpeed = values.find(),
pulse = values.find(),
)
}