Skip to content

Instantly share code, notes, and snippets.

@risicle
Created July 9, 2019 13:08
Show Gist options
  • Save risicle/cc9976c5058cedd2c68a1ae6cb2dfe99 to your computer and use it in GitHub Desktop.
Save risicle/cc9976c5058cedd2c68a1ae6cb2dfe99 to your computer and use it in GitHub Desktop.
def send_some_emails(data_api_client, framework_slug):
for supplier_framework in data_api_client.supplier_frameworks_for_framework_iter(
framework_slug,
with_declarations = True,
):
has_company_details = bool(supplier_framework["applicationCompanyDetailsConfirmed"])
declaration_complete = supplier_framework["declaration"]["status"] == "complete"
complete_services = any(
ds["status"] == "complete"
for ds in data_api_client.draft_services_iter(framework_slug, supplier_id)
)
if not ( has_company_details and declaration_complete and complete_services ):
for user in data_api_client.find_users_iter(supplier_id, active=True):
send_email("Shit, man!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment