From: Michael Orlitzky Date: Sun, 15 Jun 2014 02:11:54 +0000 (-0400) Subject: Fix a bug in the earnings pickler and mangle the sample XML document to test it. X-Git-Tag: 0.0.6~204 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=c3baa2f451e5f4bc7ff33e307bc492d7cb9c3cf0;p=dead%2Fhtsn-import.git Fix a bug in the earnings pickler and mangle the sample XML document to test it. --- diff --git a/src/TSN/Picklers.hs b/src/TSN/Picklers.hs index be4caa6..ea335c8 100644 --- a/src/TSN/Picklers.hs +++ b/src/TSN/Picklers.hs @@ -126,7 +126,7 @@ xp_earnings = to_earnings :: String -> Maybe Int to_earnings s | s == "TBA" = Nothing - | otherwise = (read . strip_commas . show) s + | otherwise = Just $ (read . strip_commas) s from_earnings :: Maybe Int -> String from_earnings Nothing = "TBA" diff --git a/test/xml/AutoRacingResultsXML.xml b/test/xml/AutoRacingResultsXML.xml index 0046b44..956daa4 100644 --- a/test/xml/AutoRacingResultsXML.xml +++ b/test/xml/AutoRacingResultsXML.xml @@ -1 +1 @@ - 21162271 ASX%BUSCH-FINAL-RESULTS Statistics NASCAR-B 1716 5/24/2014 2:45:00 PM NASCAR - Nationwide - History 300 - Final Results Charlotte Motor Speedway - Concord, NC 80 False 1 3 42 965 Kyle Larson Chevrolet 0 120 0 False TBA 2 2 22 433 Brad Keselowski Ford 0 120 0 False TBA 3 6 2 1269 Brian Scott Chevrolet 0 120 0 False TBA 4 5 5 25 Kevin Harvick Chevrolet 0 120 0 False TBA 5 7 20 28 Matt Kenseth Toyota 0 120 0 False TBA 6 1 54 304 Kyle Busch Toyota 0 120 0 False TBA 7 8 7 207 Regan Smith Chevrolet 0 120 0 False TBA 8 16 6 1343 Trevor Bayne Ford 0 120 0 False TBA 9 13 60 653 Chris Buescher Ford 0 120 0 False TBA 10 11 3 1061 Ty Dillon Chevrolet 0 120 0 False TBA 1.5 200 965 Kyle Larson 0 May 24, 2014, at 04:18 PM ET \ No newline at end of file + 21162271 ASX%BUSCH-FINAL-RESULTS Statistics NASCAR-B 1716 5/24/2014 2:45:00 PM NASCAR - Nationwide - History 300 - Final Results Charlotte Motor Speedway - Concord, NC 80 False 1 3 42 965 Kyle Larson Chevrolet 0 120 0 False 123,456 2 2 22 433 Brad Keselowski Ford 0 120 0 False TBA 3 6 2 1269 Brian Scott Chevrolet 0 120 0 False TBA 4 5 5 25 Kevin Harvick Chevrolet 0 120 0 False TBA 5 7 20 28 Matt Kenseth Toyota 0 120 0 False TBA 6 1 54 304 Kyle Busch Toyota 0 120 0 False TBA 7 8 7 207 Regan Smith Chevrolet 0 120 0 False TBA 8 16 6 1343 Trevor Bayne Ford 0 120 0 False TBA 9 13 60 653 Chris Buescher Ford 0 120 0 False TBA 10 11 3 1061 Ty Dillon Chevrolet 0 120 0 False TBA 1.5 200 965 Kyle Larson 0 May 24, 2014, at 04:18 PM ET \ No newline at end of file