From a211fb5962754876fb5c7538c50dd3f7b89aface Mon Sep 17 00:00:00 2001 From: Carlos Quiroz Date: Fri, 25 Oct 2024 17:38:56 -0300 Subject: [PATCH] Acquisition steps are optional --- .../main/scala/explore/model/ExecutionOffsets.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/model/shared/src/main/scala/explore/model/ExecutionOffsets.scala b/model/shared/src/main/scala/explore/model/ExecutionOffsets.scala index 54de427cd0..7e929119fd 100644 --- a/model/shared/src/main/scala/explore/model/ExecutionOffsets.scala +++ b/model/shared/src/main/scala/explore/model/ExecutionOffsets.scala @@ -21,21 +21,21 @@ case class ExecutionSequence( possibleFuture: List[AtomOffset] ) derives Decoder -case class ExecutionOffsets(science: ExecutionSequence, acquisition: ExecutionSequence): +case class ExecutionOffsets(science: ExecutionSequence, acquisition: Option[ExecutionSequence]): def allScienceOffsets: List[Offset] = science.nextAtom.steps.flatMap(_.stepConfig.offset) ++ science.possibleFuture.flatMap(_.steps.flatMap(_.stepConfig.offset)) def allAcquisitionOffsets: List[Offset] = - acquisition.nextAtom.steps.flatMap(_.stepConfig.offset) ++ - acquisition.possibleFuture.flatMap(_.steps.flatMap(_.stepConfig.offset)) + acquisition.foldMap(_.nextAtom.steps.flatMap(_.stepConfig.offset)) ++ + acquisition.foldMap(_.possibleFuture.flatMap(_.steps.flatMap(_.stepConfig.offset))) object ExecutionOffsets: - private type OffsetTuple = (ExecutionSequence, ExecutionSequence) + private type OffsetTuple = (ExecutionSequence, Option[ExecutionSequence]) given Decoder[OffsetTuple] = Decoder.instance: c => for science <- c.downField("science").as[ExecutionSequence] - acquisition <- c.downField("acquisition").as[ExecutionSequence] + acquisition <- c.downField("acquisition").as[Option[ExecutionSequence]] yield (science, acquisition) given Decoder[ExecutionOffsets] = Decoder.instance: c =>