Skip to content

Commit

Permalink
manage bad birthdate format in FSDB importing
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Golfari committed Jun 20, 2023
1 parent 479df30 commit 281ad39
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion airscore/core/pilot/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Stuart Mackintosh Antonio Golfari - 2019
"""

import datetime
from calcUtils import get_date
from db.conn import db_session
from db.tables import TblParticipant as P, TblParticipantMeta as PA, TblCompAttribute as CA
Expand Down Expand Up @@ -141,7 +142,8 @@ def from_fsdb(pil, from_CIVL=False, comp_attributes=None):
pilot = Participant(name=abbreviate(name), civl_id=CIVLID)
pilot.sex = 'F' if int(pil.get('female') if pil.get('female') else 0) > 0 else 'M'
pilot.nat = pil.get('nat_code_3166_a3') or None
pilot.birthdate = get_date(pil.get('birthday') or None)
bd = get_date(pil.get('birthday') or None)
pilot.birthdate = None if not isinstance(bd, datetime.date) else bd
pilot.ID = get_int(pil.get('id'))
pilot.glider = abbreviate(pil.get('glider')) or None
pilot.sponsor = abbreviate(pil.get('sponsor')) or None
Expand Down

0 comments on commit 281ad39

Please sign in to comment.