Skip to content

Commit

Permalink
Merge f5b6931 into 5bbcdb6
Browse files Browse the repository at this point in the history
  • Loading branch information
dhakim87 committed Aug 24, 2020
2 parents 5bbcdb6 + f5b6931 commit 6752272
Showing 1 changed file with 38 additions and 11 deletions.
49 changes: 38 additions & 11 deletions microsetta_private_api/admin/admin_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,45 @@ def send_email(body, token_info):
diag = AdminRepo(t).retrieve_diagnostics_by_barcode(
body["template_args"]["sample_barcode"],
grab_kit=False)
account_id = diag["account"].id
source_id = diag["source"].id
sample_id = diag["sample"].id
email = diag["account"].email
contact_name = diag["account"].first_name + " " + \
diag["account"].last_name
contact_name = contact_name.strip()
account_id = None
email = None
contact_name = None
if diag["account"] is not None:
account_id = diag["account"].id
email = diag["account"].email
contact_name = diag["account"].first_name + " " + \
diag["account"].last_name
contact_name = contact_name.strip()

source_id = None
if diag["source"] is not None:
source_id = diag["source"].id

sample_id = None
if diag["sample"] is not None:
sample_id = diag["sample"].id
endpoint = SERVER_CONFIG["endpoint"]
resolution_url = build_login_redirect(
endpoint + "/accounts/%s/sources/%s/samples/%s" %
(account_id, source_id, sample_id)
)

if sample_id is not None and \
source_id is not None and \
account_id is not None:
resolution_url = build_login_redirect(
endpoint + "/accounts/%s/sources/%s/samples/%s" %
(account_id, source_id, sample_id)
)
elif account_id is not None and source_id is not None:
resolution_url = build_login_redirect(
endpoint + "/accounts/%s/sources/%s" %
(account_id, source_id)
)
elif account_id is not None:
resolution_url = build_login_redirect(
endpoint + "/accounts/%s" % (account_id,)
)
else:
resolution_url = build_login_redirect(
endpoint + "/"
)
else:
raise Exception("Update Admin Impl to support more issue types")

Expand Down

0 comments on commit 6752272

Please sign in to comment.