Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pbugni committed Oct 16, 2023
2 parents 4871461 + 51eb541 commit 888c538
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions portal/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ def withdraw_user_consent(user_id):
org_id = request.json.get('organization_id')
if not org_id:
abort(400, "missing required organization ID")
research_study_id = request.json.get('research_study_id', 0)
research_study_id = int(request.json.get('research_study_id', 0))
acceptance_date = None
if 'acceptance_date' in request.json:
acceptance_date = FHIR_datetime.parse(request.json['acceptance_date'])
Expand Down Expand Up @@ -881,10 +881,10 @@ def withdraw_consent(

# replace with requested time, provided it's in a valid window
prior_consent, prior_withdrawal = consent_withdrawal_dates(user, research_study_id)
if acceptance_date == prior_withdrawal:
if prior_withdrawal and acceptance_date == prior_withdrawal:
# valid nop, leave.
return jsonify(wc.as_json())
if acceptance_date < prior_consent:
if prior_consent and acceptance_date < prior_consent:
raise ValueError(
f"Can't suspend with acceptance date {acceptance_date} "
f"prior to last valid consent {prior_consent}")
Expand Down

0 comments on commit 888c538

Please sign in to comment.