X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn-import.git;a=blobdiff_plain;f=src%2FTSN%2FXML%2FJFile.hs;fp=src%2FTSN%2FXML%2FJFile.hs;h=f570784083f22ef662e451ba42bb8a25055c5d90;hp=80d13fe8354b5d353f343924e7e9bd9ab6fda90a;hb=fdd85d5ed7944e6a6373c99c2e341f370cd931f8;hpb=073bbfba4165d4c01d29daaa7523c35c6cc7d114 diff --git a/src/TSN/XML/JFile.hs b/src/TSN/XML/JFile.hs index 80d13fe..f570784 100644 --- a/src/TSN/XML/JFile.hs +++ b/src/TSN/XML/JFile.hs @@ -23,7 +23,7 @@ module TSN.XML.JFile ( where -- System imports -import Control.Monad ( forM_ ) +import Control.Monad ( forM_, join ) import Data.List ( intercalate ) import Data.String.Utils ( split ) import Data.Time ( UTCTime(..) ) @@ -61,6 +61,7 @@ import Text.XML.HXT.Core ( -- Local imports +import Misc ( double_just ) import TSN.Codegen ( tsn_codegen_config ) import TSN.Database ( insert_or_select ) import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate ) @@ -458,7 +459,7 @@ pickle_gamelist = pickle_game :: PU JFileGameXml pickle_game = xpElem "game" $ - xpWrap (from_tuple, H.convert) $ + xpWrap (from_tuple, to_tuple') $ xp14Tuple (xpElem "game_id" xpInt) (xpElem "schedule_id" xpInt) pickle_odds_info @@ -466,7 +467,7 @@ pickle_game = (xpElem "Game_Date" xp_date_padded) (xpElem "Game_Time" xp_tba_time) pickle_away_team - (xpOption $ xpElem "vleague" xpText) + (xpOption $ xpElem "vleague" (xpOption xpText)) pickle_home_team (xpOption $ xpElem "hleague" xpText) (xpElem "vscore" xpInt) @@ -474,7 +475,11 @@ pickle_game = (xpOption $ xpElem "time_r" xpText) pickle_status where - from_tuple = uncurryN JFileGameXml + from_tuple (a,b,c,d,e,f,g,h,i,j,k,l,m,n) = + JFileGameXml a b c d e f g (join h) i j k l m n + + to_tuple' (JFileGameXml a b c d e f g h i j k l m n) = + (a, b, c, d, e, f, g, double_just h, i, j, k, l, m, n) pickle_odds_info :: PU JFileGameOddsInfo