scout/server/blueprints/cases/views.py
def delivery_report(institute_id, case_name):
    """Display delivery report."""
    institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
    if case_obj.get('delivery_report') is None:
        return abort(404)

    date_str = request.args.get('date')
    if date_str:
        delivery_report = None
        analysis_date = parse_date(date_str)
        for analysis_data in case_obj['analyses']:
            if analysis_data['date'] == analysis_date:
                delivery_report = analysis_data['delivery_report']
        if delivery_report is None:
            return abort(404)
    else:
        delivery_report = case_obj['delivery_report']

    out_dir = os.path.dirname(delivery_report)
    filename = os.path.basename(delivery_report)
    return send_from_directory(out_dir, filename)
def delivery_report(institute_id, case_name):
    """Display delivery report."""
    institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
    if case_obj.get('delivery_report') is None:
        return abort(404)

    date_str = request.args.get('date')
    if date_str:
        delivery_report = None
        analysis_date = parse_date(date_str)
        for analysis_data in case_obj['analyses']:
            if analysis_data['date'] == analysis_date:
                delivery_report = analysis_data['delivery_report']
        if delivery_report is None:
            return abort(404)
    else:
        delivery_report = case_obj['delivery_report']

    out_dir = os.path.dirname(delivery_report)
    filename = os.path.basename(delivery_report)
    return send_from_directory(out_dir, filename)
Display delivery report.