]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blobdiff - src/TSN/XML/AutoRacingSchedule.hs
Rename some unique constraints for consistency.
[dead/htsn-import.git] / src / TSN / XML / AutoRacingSchedule.hs
index 01611d237157e0fa52d98fd36406afef7337be0b..a7d683ae4033c5eaea604cacf210ed074588fb19 100644 (file)
@@ -266,7 +266,8 @@ data AutoRacingScheduleListingRaceResultRaceResultListing =
     db_leading_laps :: Int,
     db_listing_laps :: Int, -- ^ Avoid clash with race's \"laps\" field.
     db_earnings :: String,  -- ^ This should be an Int, but can have commas.
-    db_status :: String }
+    db_status :: Maybe String -- ^ They can be empty
+    }
 
 
 -- | XML Representation of an
@@ -280,7 +281,8 @@ data AutoRacingScheduleListingRaceResultRaceResultListingXml =
     xml_leading_laps :: Int,
     xml_listing_laps :: Int, -- ^ Avoid clash with race's \"laps\" field.
     xml_earnings :: String,  -- ^ Should be an 'Int', but can have commas.
-    xml_status :: String }
+    xml_status :: Maybe String -- ^ They can be empty
+    }
   deriving (Eq, Show)
 
 
@@ -318,7 +320,7 @@ instance FromXmlFk AutoRacingScheduleListingRaceResultRaceResultListingXml where
       db_leading_laps = xml_leading_laps,
       db_listing_laps = xml_listing_laps,
       db_earnings = xml_earnings,
-      db_status = xml_earnings }
+      db_status = xml_status }
 
 
 -- | This allows us to insert the XML representation
@@ -361,7 +363,7 @@ mkPersist tsn_codegen_config [groundhog|
   constructors:
     - name: AutoRacingSchedule
       uniques:
-        - name: unique_auto_racing_schedule
+        - name: unique_auto_racing_schedules
           type: constraint
           # Prevent multiple imports of the same message.
           fields: [db_xml_file_id]
@@ -474,7 +476,7 @@ pickle_race_results_listing =
                (xpElem "LeadingLaps" xpInt)
                (xpElem "Laps" xpInt)
                (xpElem "Earnings" xpText)
-               (xpElem "Status" xpText)
+               (xpElem "Status" (xpOption xpText))
   where
     from_tuple =
       uncurryN AutoRacingScheduleListingRaceResultRaceResultListingXml