+instance FromXml OddsGameXml where
+ -- | To convert from the XML representation to the database one, we
+ -- drop the home/away teams and the casino lines, but retain the
+ -- home/away rotation numbers.
+ --
+ from_xml OddsGameXml{..} =
+ OddsGame {
+ db_game_id = xml_game_id,
+
+ db_game_time = UTCTime
+ (utctDay xml_game_date) -- Take the day part from one,
+ (utctDayTime xml_game_time), -- the time from the other.
+
+ db_game_away_team_rotation_number =
+ (xml_away_rotation_number xml_game_away_team),
+
+ db_game_home_team_rotation_number =
+ (xml_home_rotation_number xml_game_home_team) }
+
+-- | This lets us call 'insert_xml' directly on an 'OddsGameXml'
+-- without converting it to the database representation explicitly.
+--