From 8bc29f5e9213e06e92273539e29aea37a6c18e3c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 14 Jan 2014 21:28:07 -0500 Subject: [PATCH] Combine the odds game date/time into one DB field. --- src/TSN/XML/Odds.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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) } -- 2.43.2