Beispiel #1
0
def make_columns(global_stats, complaints_number, callback_stats):
    return [
        # email
        {
            'black_box': {
                'number': global_stats['email']['total'],
                'notification_type': 'email'
            },
            'other_data': [
                get_tech_failure_status_box_data(global_stats['email']),
                get_status_box_data(global_stats['email'], 'permanent-failure',
                                    'permanent failures'),
                get_status_box_data(global_stats['email'], 'temporary-failure',
                                    'temporary failures'),
                {
                    'number':
                    complaints_number,
                    'label':
                    'complaints',
                    'failing':
                    is_over_threshold(complaints_number,
                                      global_stats['email']['total'],
                                      COMPLAINT_THRESHOLD),
                    'percentage':
                    get_formatted_percentage_two_dp(
                        complaints_number, global_stats['email']['total']),
                    'url':
                    url_for('main.platform_admin_list_complaints')
                }
            ],
            'test_data': {
                'number': global_stats['email']['test-key'],
                'label': 'test emails'
            }
        },
        # sms
        {
            'black_box': {
                'number': global_stats['sms']['total'],
                'notification_type': 'sms'
            },
            'other_data': [
                get_tech_failure_status_box_data(global_stats['sms']),
                get_status_box_data(global_stats['sms'], 'permanent-failure',
                                    'permanent failures'),
                get_status_box_data(global_stats['sms'], 'temporary-failure',
                                    'temporary failures'),
                {
                    'number': callback_stats.get('total_failure_count'),
                    'label': 'callback failures',
                    'url':
                    url_for('main.platform_admin_callback_failure_summary')
                },
            ],
            'test_data': {
                'number': global_stats['sms']['test-key'],
                'label': 'test text messages'
            }
        },
    ]
def make_columns(global_stats, complaints_number):
    return [
        # email
        {
            'black_box': {
                'number': global_stats['email']['total'],
                'notification_type': 'email'
            },
            'other_data': [
                get_tech_failure_status_box_data(global_stats['email']),
                get_status_box_data(global_stats['email'], 'permanent-failure', 'permanent failures'),
                get_status_box_data(global_stats['email'], 'temporary-failure', 'temporary failures'),
                {
                    'number': complaints_number,
                    'label': 'complaints',
                    'failing': is_over_threshold(complaints_number,
                                                 global_stats['email']['total'], COMPLAINT_THRESHOLD),
                    'percentage': get_formatted_percentage_two_dp(complaints_number, global_stats['email']['total']),
                    'url': url_for('main.platform_admin_list_complaints')
                }
            ],
            'test_data': {
                'number': global_stats['email']['test-key'],
                'label': 'test emails'
            }
        },
        # sms
        {
            'black_box': {
                'number': global_stats['sms']['total'],
                'notification_type': 'sms'
            },
            'other_data': [
                get_tech_failure_status_box_data(global_stats['sms']),
                get_status_box_data(global_stats['sms'], 'permanent-failure', 'permanent failures'),
                get_status_box_data(global_stats['sms'], 'temporary-failure', 'temporary failures')
            ],
            'test_data': {
                'number': global_stats['sms']['test-key'],
                'label': 'test text messages'
            }
        },
        # letter
        {
            'black_box': {
                'number': global_stats['letter']['total'],
                'notification_type': 'letter'
            },
            'other_data': [
                get_tech_failure_status_box_data(global_stats['letter']),
                get_status_box_data(global_stats['letter'],
                                    'virus-scan-failed', 'virus scan failures', ZERO_FAILURE_THRESHOLD)
            ],
            'test_data': {
                'number': global_stats['letter']['test-key'],
                'label': 'test letters'
            }
        },
    ]
def make_columns(global_stats, complaints_number):
    return [
        # email
        {
            "black_box": {
                "number": global_stats["email"]["total"],
                "notification_type": "email",
            },
            "other_data": [
                get_tech_failure_status_box_data(global_stats["email"]),
                get_status_box_data(global_stats["email"], "permanent-failure", "permanent failures"),
                get_status_box_data(global_stats["email"], "temporary-failure", "temporary failures"),
                {
                    "number": complaints_number,
                    "label": "complaints",
                    "failing": is_over_threshold(
                        complaints_number,
                        global_stats["email"]["total"],
                        COMPLAINT_THRESHOLD,
                    ),
                    "percentage": get_formatted_percentage_two_dp(complaints_number, global_stats["email"]["total"]),
                    "url": url_for("main.platform_admin_list_complaints"),
                },
            ],
            "test_data": {
                "number": global_stats["email"]["test-key"],
                "label": "test emails",
            },
        },
        # sms
        {
            "black_box": {
                "number": global_stats["sms"]["total"],
                "notification_type": "sms",
            },
            "other_data": [
                get_tech_failure_status_box_data(global_stats["sms"]),
                get_status_box_data(global_stats["sms"], "permanent-failure", "permanent failures"),
                get_status_box_data(global_stats["sms"], "temporary-failure", "temporary failures"),
            ],
            "test_data": {
                "number": global_stats["sms"]["test-key"],
                "label": "test text messages",
            },
        },
        # letter
        {
            "black_box": {
                "number": global_stats["letter"]["total"],
                "notification_type": "letter",
            },
            "other_data": [
                get_tech_failure_status_box_data(global_stats["letter"]),
                get_status_box_data(
                    global_stats["letter"],
                    "virus-scan-failed",
                    "virus scan failures",
                    ZERO_FAILURE_THRESHOLD,
                ),
            ],
            "test_data": {
                "number": global_stats["letter"]["test-key"],
                "label": "test letters",
            },
        },
    ]