From: Michael Orlitzky Date: Wed, 15 Jan 2014 02:28:07 +0000 (-0500) Subject: Combine the odds game date/time into one DB field. X-Git-Tag: 0.0.1~52 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=8bc29f5e9213e06e92273539e29aea37a6c18e3c;p=dead%2Fhtsn-import.git Combine the odds game date/time into one DB field. --- diff --git a/src/TSN/XML/Odds.hs b/src/TSN/XML/Odds.hs index 467dbcf..bbed4af 100644 --- a/src/TSN/XML/Odds.hs +++ b/src/TSN/XML/Odds.hs @@ -27,7 +27,7 @@ where -- System imports. import Control.Monad ( forM_, join ) -import Data.Time ( UTCTime ) +import Data.Time ( UTCTime(..) ) import Data.Tuple.Curry ( uncurryN ) import Database.Groundhog ( (=.), @@ -257,8 +257,7 @@ data OddsGameLine = data OddsGame = OddsGame { db_game_id :: Int, - db_game_date :: UTCTime, - db_game_time :: UTCTime, + db_game_time :: UTCTime, -- ^ Contains both the date and time. db_game_away_team_rotation_number :: Int, db_game_home_team_rotation_number :: Int } deriving (Eq, Show) @@ -268,8 +267,8 @@ data OddsGame = data OddsGameXml = OddsGameXml { xml_game_id :: Int, - xml_game_date :: UTCTime, - xml_game_time :: UTCTime, + xml_game_date :: UTCTime, -- ^ Contains only the date + xml_game_time :: UTCTime, -- ^ Contains only the time xml_game_away_team :: OddsGameAwayTeamXml, xml_game_home_team :: OddsGameHomeTeamXml, xml_game_over_under :: OddsGameOverUnderXml } @@ -295,10 +294,14 @@ instance FromXml OddsGameXml where from_xml OddsGameXml{..} = OddsGame { db_game_id = xml_game_id, - db_game_date = xml_game_date, - db_game_time = xml_game_time, + + 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) }