mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 05:29:38 -04:00
Update for new format of data returned from api
- API will now send through `created_by_name` instead of `created_by`. - API will always send through `current_month_billable_sms` but this can now be `0` instead of `None`.
This commit is contained in:
@@ -33,14 +33,11 @@ def view_providers():
|
||||
|
||||
|
||||
def add_monthly_traffic(domestic_sms_providers):
|
||||
total_sms_sent = sum(provider.get('current_month_billable_sms', 0) for provider in domestic_sms_providers)
|
||||
total_sms_sent = sum(provider['current_month_billable_sms'] for provider in domestic_sms_providers)
|
||||
|
||||
for provider in domestic_sms_providers:
|
||||
if provider.get('current_month_billable_sms'):
|
||||
percentage = (provider['current_month_billable_sms'] / total_sms_sent * 100) if total_sms_sent else 0
|
||||
provider['monthly_traffic'] = round(percentage)
|
||||
else:
|
||||
provider['monthly_traffic'] = 0
|
||||
percentage = (provider['current_month_billable_sms'] / total_sms_sent * 100) if total_sms_sent else 0
|
||||
provider['monthly_traffic'] = round(percentage)
|
||||
|
||||
|
||||
@main.route("/provider/<provider_id>/edit", methods=['GET', 'POST'])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "views/platform-admin/_base_template.html" %}
|
||||
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading %}
|
||||
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading, optional_text_field %}
|
||||
{% from "components/show-more.html" import show_more %}
|
||||
|
||||
{% block per_page_title %}
|
||||
@@ -35,11 +35,7 @@ Providers
|
||||
{{ text_field('None') }}
|
||||
{% endif %}
|
||||
|
||||
{% if item.created_by %}
|
||||
{{ text_field(item.created_by.name) }}
|
||||
{% else %}
|
||||
{{ text_field('None') }}
|
||||
{% endif %}
|
||||
{{ optional_text_field(item.created_by_name, default='None') }}
|
||||
|
||||
{{ link_field('change', url_for('main.edit_provider', provider_id=item.id)) }}
|
||||
|
||||
@@ -68,11 +64,7 @@ Providers
|
||||
{{ text_field('None') }}
|
||||
{% endif %}
|
||||
|
||||
{% if item.created_by %}
|
||||
{{ text_field(item.created_by.name) }}
|
||||
{% else %}
|
||||
{{ text_field('None') }}
|
||||
{% endif %}
|
||||
{{ optional_text_field(item.created_by_name, default='None') }}
|
||||
|
||||
{{ link_field('change', url_for('main.edit_provider', provider_id=item.id)) }}
|
||||
|
||||
@@ -101,11 +93,7 @@ Providers
|
||||
{{ text_field('None') }}
|
||||
{% endif %}
|
||||
|
||||
{% if item.created_by %}
|
||||
{{ text_field(item.created_by.name) }}
|
||||
{% else %}
|
||||
{{ text_field('None') }}
|
||||
{% endif %}
|
||||
{{ optional_text_field(item.created_by_name, default='None') }}
|
||||
|
||||
{{ link_field('change', url_for('main.edit_provider', provider_id=item.id)) }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user