--- * OddsGameHomeTeamXml / OddsGameAwayTeamXml
-
--- | The XML representation of a \<HomeTeam\>, as found in \<Game\>s.
--- This is basically the same as 'OddsGameAwayTeamXml', but the two
--- types have different picklers.
---
--- The starter id/name could perhaps be combined into an embedded
--- type, but can you make an entire embedded type optional with
--- Maybe? I doubt it works.
---
-data OddsGameHomeTeamXml =
- OddsGameHomeTeamXml {
- xml_home_team_id :: String, -- ^ The home/away team IDs
- -- are three characters but
- -- Postgres imposes no
- -- performance penalty on
- -- lengthless text fields,
- -- so we ignore the probable
- -- upper bound of three
- -- characters.
- xml_home_team_rotation_number :: Int,
- xml_home_team_abbr :: String,
- xml_home_team_name :: String,
- xml_home_team_starter :: Maybe (Int, String), -- ^ (id, name)
- xml_home_team_casinos :: [OddsGameCasinoXml] }
- deriving (Eq, Show)
-
-instance ToDb OddsGameHomeTeamXml where
- -- | The database representation of an 'OddsGameHomeTeamXml' is an
- -- 'OddsGameTeam'.
- --
- type Db OddsGameHomeTeamXml = Team
-
-instance FromXml OddsGameHomeTeamXml where
- -- | We convert from XML to the database by dropping the lines and
- -- rotation number (which are specific to the games, not the teams
- -- themselves).
- --
- from_xml OddsGameHomeTeamXml{..} =
- Team {
- team_id = xml_home_team_id,
- team_abbreviation = Just xml_home_team_abbr,
- team_name = Just xml_home_team_name }