소스 검색

Minor bug with date object

Foppe Hemminga 6 년 전
부모
커밋
ec26e8166c
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      main.py

+ 4 - 1
main.py

@@ -1,3 +1,5 @@
+import datetime
+
 import psycopg2.extras
 import model
 # from pprint import pprint
@@ -69,7 +71,8 @@ if __name__ == '__main__':
                     found_in_database = True
             if not found_in_database:
                 # report new scratching
-                day_abbr = scratching.date.strftime('%a')
+                date_object = datetime.datetime.strptime(scratching.date, "%Y%m%d").date()
+                day_abbr = date_object.strftime('%a')
                 message = 'New scratching: venue = {} {} {}-{} | race = {} | horse = {}'.format(day_abbr,
                                                                                                 scratching.date,
                                                                                                 scratching.state,