diff --git a/explore/src/clue/scala/queries/common/ObsQueriesGQL.scala b/explore/src/clue/scala/queries/common/ObsQueriesGQL.scala index 54171ce740..64eeb60d8b 100644 --- a/explore/src/clue/scala/queries/common/ObsQueriesGQL.scala +++ b/explore/src/clue/scala/queries/common/ObsQueriesGQL.scala @@ -161,6 +161,18 @@ object ObsQueriesGQL: } """ + @GraphQL + trait UpdateObservationTimesMutation extends GraphQLOperation[ObservationDB]: + val document = """ + mutation ($input: UpdateObservationsTimesInput!){ + updateObservationsTimes(input: $input) { + observations { + id + } + } + } + """ + @GraphQL trait CreateConfigurationMutation extends GraphQLOperation[ObservationDB]: val document = s""" diff --git a/explore/src/clue/scala/queries/common/ObservationSubquery.scala b/explore/src/clue/scala/queries/common/ObservationSubquery.scala index 5e63a86a14..35cac1d915 100644 --- a/explore/src/clue/scala/queries/common/ObservationSubquery.scala +++ b/explore/src/clue/scala/queries/common/ObservationSubquery.scala @@ -19,7 +19,7 @@ object ObservationSubquery extends GraphQLSubquery.Typed[ObservationDB, Observat subtitle status activeStatus - visualizationTime + observationTime posAngleConstraint $PosAngleConstraintSubquery targetEnvironment { asterism { diff --git a/explore/src/main/scala/explore/observationtree/ObsSummaryTable.scala b/explore/src/main/scala/explore/observationtree/ObsSummaryTable.scala index 9d0c0ec39d..01666b5ef9 100644 --- a/explore/src/main/scala/explore/observationtree/ObsSummaryTable.scala +++ b/explore/src/main/scala/explore/observationtree/ObsSummaryTable.scala @@ -294,7 +294,7 @@ object ObsSummaryTable: // Only expand if there are multiple targets if (targets.sizeIs > 1) targets.map: target => - Expandable(ExpandedTargetRow(obs.id, target, obs.visualizationTime)) + Expandable(ExpandedTargetRow(obs.id, target, obs.observationTime)) else Nil ) .useReactTableWithStateStoreBy: (props, ctx, cols, rows) => @@ -401,8 +401,8 @@ object ObsSummaryTable: this match case r: ExpandedTargetRow => targetCoords(r.targetWithId, r.vizTime) case r: ObsRow => - asterismCoords(r.asterism, r.obs.visualizationTime) - .orElse(r.targetWithId.flatMap(t => targetCoords(t, r.obs.visualizationTime))) + asterismCoords(r.asterism, r.obs.observationTime) + .orElse(r.targetWithId.flatMap(t => targetCoords(t, r.obs.observationTime))) private def targetCoords(twid: TargetWithId, vizTime: Option[Instant]): Option[Coordinates] = Target.sidereal diff --git a/explore/src/main/scala/explore/tabs/ObsTabTiles.scala b/explore/src/main/scala/explore/tabs/ObsTabTiles.scala index 6d957514c3..80bde48b01 100644 --- a/explore/src/main/scala/explore/tabs/ObsTabTiles.scala +++ b/explore/src/main/scala/explore/tabs/ObsTabTiles.scala @@ -274,7 +274,7 @@ object ObsTabTiles: .useStateView(().ready) .useStateView(ChartSelector.Closed) .useEffectKeepResultWithDepsBy((p, _, _, _, _, _, _, _, _, _, _, _, _, _) => - p.observation.model.get.visualizationTime + p.observation.model.get.observationTime ): (_, _, _, _, _, _, _, _, _, _, _, _, _, _) => vizTime => IO(vizTime.getOrElse(Instant.now())) .render: @@ -317,7 +317,7 @@ object ObsTabTiles: props.observation.get.observingMode.map(_.toBasicConfiguration) val vizTimeView: View[Option[Instant]] = - props.observation.model.zoom(Observation.visualizationTime) + props.observation.model.zoom(Observation.observationTime) val asterismAsNel: Option[NonEmptyList[TargetWithId]] = NonEmptyList.fromList: diff --git a/explore/src/main/scala/explore/tabs/TargetTabContents.scala b/explore/src/main/scala/explore/tabs/TargetTabContents.scala index d1d0ed9a76..97acd2d480 100644 --- a/explore/src/main/scala/explore/tabs/TargetTabContents.scala +++ b/explore/src/main/scala/explore/tabs/TargetTabContents.scala @@ -197,7 +197,7 @@ object TargetTabContents extends TwoPanels: for id <- idsToEdit.single o <- a.observations.getValue(id) - t <- o.visualizationTime + t <- o.observationTime yield t def modVizTime( @@ -208,7 +208,7 @@ object TargetTabContents extends TwoPanels: ProgramSummaries.observations .filterIndex((id: Observation.Id) => id === i) .andThen(KeyedIndexedList.value) - .andThen(Observation.visualizationTime) + .andThen(Observation.observationTime) .modify(mod)(ps) ) .getOrElse(ps) diff --git a/explore/src/main/scala/queries/schemas/odb/ObsQueries.scala b/explore/src/main/scala/queries/schemas/odb/ObsQueries.scala index e2767b404a..32c2941ea2 100644 --- a/explore/src/main/scala/queries/schemas/odb/ObsQueries.scala +++ b/explore/src/main/scala/queries/schemas/odb/ObsQueries.scala @@ -82,17 +82,17 @@ object ObsQueries: } def updateVisualizationTime[F[_]: Async]( - obsIds: List[Observation.Id], - visualizationTime: Option[Instant] + obsIds: List[Observation.Id], + observationTime: Option[Instant] )(using FetchClient[F, ObservationDB]): F[Unit] = { - val editInput = ObservationPropertiesInput(visualizationTime = - visualizationTime.flatMap(Timestamp.fromInstantTruncated).orUnassign + val editInput = ObservationTimesInput(observationTime = + observationTime.flatMap(Timestamp.fromInstantTruncated).orUnassign ) - UpdateObservationMutation[F] + UpdateObservationTimesMutation[F] .execute( - UpdateObservationsInput( + UpdateObservationsTimesInput( WHERE = obsIds.toWhereObservation.assign, SET = editInput ) diff --git a/model-testkit/shared/src/main/scala/explore/model/arb/ArbObservation.scala b/model-testkit/shared/src/main/scala/explore/model/arb/ArbObservation.scala index 4d43fcf7b8..6fbc42a264 100644 --- a/model-testkit/shared/src/main/scala/explore/model/arb/ArbObservation.scala +++ b/model-testkit/shared/src/main/scala/explore/model/arb/ArbObservation.scala @@ -121,7 +121,7 @@ trait ArbObservation: o.timingWindows, o.scienceRequirements, o.observingMode, - o.visualizationTime, + o.observationTime, o.posAngleConstraint, o.wavelength, o.groupId, diff --git a/model/shared/src/main/scala/explore/model/ElevationPlotOptions.scala b/model/shared/src/main/scala/explore/model/ElevationPlotOptions.scala index 1140f1ca47..46a595cfe7 100644 --- a/model/shared/src/main/scala/explore/model/ElevationPlotOptions.scala +++ b/model/shared/src/main/scala/explore/model/ElevationPlotOptions.scala @@ -33,8 +33,8 @@ case class ElevationPlotOptions( elevationPlotSkyBrightnessVisible: Visible, elevationPlotLunarElevationVisible: Visible ) derives Eq: - def withDateAndSemesterOf(visualizationTime: Instant): ElevationPlotOptions = - val (date, semester) = ElevationPlotOptions.dateAndSemesterOf(visualizationTime.some, site) + def withDateAndSemesterOf(observationTime: Instant): ElevationPlotOptions = + val (date, semester) = ElevationPlotOptions.dateAndSemesterOf(observationTime.some, site) copy(date = date, semester = semester) def minInstant: Instant = @@ -73,12 +73,12 @@ object ElevationPlotOptions: Focus[ElevationPlotOptions](_.elevationPlotLunarElevationVisible) private def dateAndSemesterOf( - visualizationTime: Option[Instant], - site: Site + observationTime: Option[Instant], + site: Site ): (LocalDate, Semester) = val date: LocalDate = ObservingNight - .fromSiteAndInstant(site, visualizationTime.getOrElse(Instant.now)) + .fromSiteAndInstant(site, observationTime.getOrElse(Instant.now)) .toLocalDate // if `fromLocalDate` returns None, date is out of range, so clamp // semester to the Min and Max semesters @@ -89,14 +89,14 @@ object ElevationPlotOptions: (date, semester) def default( - predefinedSite: Option[Site], - visualizationTime: Option[Instant], - coords: CoordinatesAtVizTime + predefinedSite: Option[Site], + observationTime: Option[Instant], + coords: CoordinatesAtVizTime ) = val site: Site = predefinedSite.getOrElse( if (coords.value.dec.toAngle.toSignedDoubleDegrees > -5) Site.GN else Site.GS ) - val (date, semester) = dateAndSemesterOf(visualizationTime, site) + val (date, semester) = dateAndSemesterOf(observationTime, site) ElevationPlotOptions( site, diff --git a/model/shared/src/main/scala/explore/model/Observation.scala b/model/shared/src/main/scala/explore/model/Observation.scala index c7f9c21acf..ef7531d3f9 100644 --- a/model/shared/src/main/scala/explore/model/Observation.scala +++ b/model/shared/src/main/scala/explore/model/Observation.scala @@ -55,7 +55,7 @@ case class Observation( attachmentIds: SortedSet[ObsAttachment.Id], scienceRequirements: ScienceRequirements, observingMode: Option[ObservingMode], - visualizationTime: Option[Instant], + observationTime: Option[Instant], posAngleConstraint: PosAngleConstraint, wavelength: Option[Wavelength], groupId: Option[Group.Id], @@ -98,7 +98,7 @@ case class Observation( _, _ ) => - val defaultMode = + val defaultMode = GmosCcdMode( defaultXBin, defaultYBin, @@ -106,6 +106,7 @@ case class Observation( defaultAmpGain, defaultAmpReadMode ) + val overridenMode: GmosCcdMode = List(explicitXBin, explicitYBin, explicitAmpGain, explicitAmpReadMode).foldLeft( defaultMode @@ -142,7 +143,7 @@ case class Observation( _, _ ) => - val defaultMode = + val defaultMode = GmosCcdMode( defaultXBin, defaultYBin, @@ -150,6 +151,7 @@ case class Observation( defaultAmpGain, defaultAmpReadMode ) + val overridenMode: GmosCcdMode = List(explicitXBin, explicitYBin, explicitAmpGain, explicitAmpReadMode).foldLeft( defaultMode @@ -183,7 +185,7 @@ object Observation: val attachmentIds = Focus[Observation](_.attachmentIds) val scienceRequirements = Focus[Observation](_.scienceRequirements) val observingMode = Focus[Observation](_.observingMode) - val visualizationTime = Focus[Observation](_.visualizationTime) + val observationTime = Focus[Observation](_.observationTime) val posAngleConstraint = Focus[Observation](_.posAngleConstraint) val wavelength = Focus[Observation](_.wavelength) val groupId = Focus[Observation](_.groupId) @@ -213,7 +215,7 @@ object Observation: attachmentIds <- c.get[List[AttachmentIdWrapper]]("obsAttachments") scienceRequirements <- c.get[ScienceRequirements]("scienceRequirements") observingMode <- c.get[Option[ObservingMode]]("observingMode") - visualizationTime <- c.get[Option[Timestamp]]("visualizationTime") + observationTime <- c.get[Option[Timestamp]]("observationTime") posAngleConstraint <- c.get[PosAngleConstraint]("posAngleConstraint") wavelength <- c.downField("scienceRequirements") .downField("spectroscopy") @@ -235,7 +237,7 @@ object Observation: SortedSet.from(attachmentIds.map(_.id)), scienceRequirements, observingMode, - visualizationTime.map(_.toInstant), + observationTime.map(_.toInstant), posAngleConstraint, wavelength, groupId, diff --git a/project/Versions.scala b/project/Versions.scala index 062b7add37..06e6a90c44 100644 --- a/project/Versions.scala +++ b/project/Versions.scala @@ -25,8 +25,8 @@ object Versions { val lucumaCatalog = "0.47.3" val lucumaReact = "0.70.0" val lucumaRefined = "0.1.3" - val lucumaSchemas = "0.94.1" - val lucumaOdbSchema = "0.11.13" + val lucumaSchemas = "0.95.0" + val lucumaOdbSchema = "0.11.14" val lucumaSSO = "0.6.21" val lucumaUI = "0.114.0" val lucumaITC = "0.21.17"