Exemple #1
0
def email_other_cases_details(domain, transitions, uploaded_filename, user_email):
    try:
        transition_objs = [Transition(**transition) for transition in transitions]
        filestream = OtherCases(domain).dump(transition_objs)
    except Exception as e:
        notify_failure(
            e,
            subject=f"[{settings.SERVER_ENVIRONMENT}] - Location Reassignment Other Cases Dump Failed",
            email=user_email,
            uploaded_filename=uploaded_filename
        )
        raise e
    else:
        body = f"The request has been successfully completed for file {uploaded_filename}. "
        if not filestream:
            body += "There were no cases found. "
        body += f"Please note that the cases are fetched only for " \
                f"{', '.join(OtherCases.valid_operations)}."
        notify_success(
            subject=f"[{settings.SERVER_ENVIRONMENT}] - Location Reassignment Other Cases Dump Completed",
            body=body,
            email=user_email,
            filestream=filestream,
            filename=f"Other Cases - {uploaded_filename.split('.')[0]}.xlsx"
        )
Exemple #2
0
def process_location_reassignment(domain, transitions, uploaded_filename, user_email):
    try:
        Processor(domain, transitions).process()
    except Exception as e:
        notify_failure(
            e,
            subject=f"[{settings.SERVER_ENVIRONMENT}] - Location Reassignment Failed",
            email=user_email,
            uploaded_filename=uploaded_filename
        )
        raise e
    else:
        notify_success(
            subject=f"[{settings.SERVER_ENVIRONMENT}] - Location Reassignment Completed",
            body=f"The request has been successfully completed for file {uploaded_filename}.",
            email=user_email
        )