-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1617 from gemini-hlsw/observation-query
Limit observations to ACCEPTED, or ENGINEERING or CALIBRATION programs
- Loading branch information
Showing
5 changed files
with
89 additions
and
62 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
modules/model/shared/src/main/scala/observe/model/extensions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA) | ||
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause | ||
|
||
package observe.model | ||
|
||
import cats.syntax.option.* | ||
import lucuma.core.enums.Instrument | ||
import lucuma.core.enums.Site | ||
|
||
object extensions: | ||
extension (i: Instrument) | ||
def hasOI: Boolean = i match | ||
// case Instrument.F2 => true | ||
case Instrument.GmosSouth => true | ||
case Instrument.GmosNorth => true | ||
case _ => false | ||
// case Instrument.Nifs => true | ||
// case Instrument.Niri => true | ||
// case Instrument.Gnirs => true | ||
// case Instrument.Gsaoi => false | ||
// case Instrument.Gpi => true | ||
// case Instrument.Ghost => false | ||
|
||
def site: Option[Site] = i match | ||
// GS | ||
case Instrument.GmosSouth => Site.GS.some | ||
case Instrument.Flamingos2 => Site.GS.some | ||
case Instrument.Ghost => Site.GS.some | ||
case Instrument.Gpi => Site.GS.some | ||
case Instrument.Gsaoi => Site.GS.some | ||
// GN | ||
case Instrument.GmosNorth => Site.GN.some | ||
case Instrument.Gnirs => Site.GN.some | ||
case Instrument.Niri => Site.GN.some | ||
case Instrument.Nifs => Site.GN.some | ||
// None | ||
case _ => none | ||
|
||
private val SiteInstruments: Map[Site, List[Instrument]] = | ||
Instrument.all | ||
.filter(_.site.isDefined) | ||
.groupBy(_.site.get) | ||
|
||
extension (site: Site) | ||
def instruments: List[Instrument] = | ||
SiteInstruments(site) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters