Foppe Hemminga преди 6 години
родител
ревизия
97a5c9b4b5
променени са 1 файла, в които са добавени 5 реда и са изтрити 4 реда
  1. 5 4
      model.py

+ 5 - 4
model.py

@@ -150,9 +150,9 @@ def send_messages(scratches, source, start=0):
 
 
 def store_scratched_horses(db, full_scratches):
-    query = """INSERT INTO horses(venue, race_date, race, horse_no, horse_display_name) 
-    VALUES(%s, %s, %s, %s, %s)
-    ON CONFLICT(venue, race_date, race, horse_no) DO NOTHING;"""
+    query = """INSERT INTO horses(venue, race_date, race, horse_no, horse_display_name, utctime) 
+    VALUES(%s, %s, %s, %s, %s, %s)
+    ON CONFLICT(race, horse_no, utctime) DO NOTHING;"""
 
     scratches_to_return = []
     regex = r'^INSERT \d+ (\d+)$'
@@ -160,7 +160,8 @@ def store_scratched_horses(db, full_scratches):
     for this_scratching in full_scratches:
         database_entry = (this_scratching.venue, this_scratching.date,
                           this_scratching.race, this_scratching.horse_no,
-                          this_scratching.horse_display_name)
+                          this_scratching.horse_display_name,
+                          this_scratching.utc)
         cur3.execute(query, database_entry)
         match = re.match(regex, cur3.statusmessage)
         status = 0