Skip to content

Commit

Permalink
skip deleted patients in migration; ignore re-started consents.
Browse files Browse the repository at this point in the history
  • Loading branch information
pbugni committed Feb 6, 2024
1 parent 956e51b commit 4560b3b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion portal/migrations/versions/3c871e710277_.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ def upgrade():
# special cases best left alone
continue
user = User.query.get(patient_id)
consent_date, withdrawal_date = consent_withdrawal_dates(user, study_id)
if user.deleted:
continue
consent_date, withdrawal_date = consent_withdrawal_dates(
user, study_id)
if withdrawal_date is None:
# scenario happens with a withdrawn patient re-start
# i.e. as withdrawal was entered in error.
# no change needed in this situation
continue

# report if dates don't match spreadsheet in IRONN-210
cd_str = '{dt.day}-{dt:%b}-{dt:%y}'.format(dt=consent_date)
Expand Down

0 comments on commit 4560b3b

Please sign in to comment.