Skip to content

Commit

Permalink
Merge pull request #348 from hongwei1/develop
Browse files Browse the repository at this point in the history
refactor/enhanced the performance and code clean
  • Loading branch information
simonredfern authored Dec 6, 2023
2 parents 7030e30 + 6f0a818 commit b2ffa95
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 222 deletions.
12 changes: 0 additions & 12 deletions apimanager/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ def get_banks(request):
except APIError as err:
messages.error(request, err)
return []
def get_consumers(request):
api = API(request.session.get('obp'))
try:
urlpath = '/management/consumers'
result = api.get(urlpath)
if 'consumers' in result:
return [consumer['consumer_id'] for consumer in sorted(result['consumers'], key=lambda d: d['consumer_id'])]
else:
return []
except APIError as err:
messages.error(request, err)
return []

def get_api_versions(request):
api = API(request.session.get('obp'))
Expand Down
6 changes: 3 additions & 3 deletions apimanager/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1075,12 +1075,12 @@ msgstr "Medianzeit von der Verbraucherregistrierung bis zum ersten API-Aufruf"
#: metrics/templates/metrics/quarterly_summary.html:108
#: metrics/templates/metrics/weekly_summary.html:106
#: metrics/templates/metrics/yearly_summary.html:106
msgid "Apps with distinct names"
msgid "New apps with distinct names"
msgstr "Apps mit eindeutigen Namen"

#: metrics/templates/metrics/custom_summary.html:115
#: metrics/templates/metrics/monthly_summary.html:118
msgid "Distinct developer email addresses"
msgid "New distinct developer email addresses"
msgstr "Unterschiedliche Entwickler-E-Mail-Adressen"

#: metrics/templates/metrics/custom_summary.html:120
Expand Down Expand Up @@ -1192,7 +1192,7 @@ msgstr "Durchschnittliche Anzahl der Anrufe pro Stunde"
#: metrics/templates/metrics/hourly_summary.html:110
#: metrics/templates/metrics/quarterly_summary.html:112
#: metrics/templates/metrics/weekly_summary.html:110
msgid "Apps with distinct developer email addresses"
msgid "Apps with New distinct developer email addresses"
msgstr "Apps mit unterschiedlichen Entwickler-E-Mail-Adressen"

#: metrics/templates/metrics/hourly_summary.html:20
Expand Down
6 changes: 3 additions & 3 deletions apimanager/locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1412,12 +1412,12 @@ msgstr ""
#: metrics/templates/metrics/quarterly_summary.html:115
#: metrics/templates/metrics/weekly_summary.html:111
#: metrics/templates/metrics/yearly_summary.html:113
msgid "Apps with distinct names"
msgid "New apps with distinct names"
msgstr "Aplicaciones con nombres distintos"

#: metrics/templates/metrics/custom_summary.html:113
#: metrics/templates/metrics/monthly_summary.html:110
msgid "Distinct developer email addresses"
msgid "New distinct developer email addresses"
msgstr "Distintas direcciones de correo electrónico para desarrolladores"

#: metrics/templates/metrics/custom_summary.html:118
Expand Down Expand Up @@ -1502,7 +1502,7 @@ msgstr "Número promedio de llamadas"
#: metrics/templates/metrics/hourly_summary.html:117
#: metrics/templates/metrics/quarterly_summary.html:119
#: metrics/templates/metrics/weekly_summary.html:115
msgid "Apps with distinct developer email addresses"
msgid "Apps with New distinct developer email addresses"
msgstr ""
"Aplicaciones con distintas direcciones de correo electrónico de los "
"desarrolladores"
Expand Down
6 changes: 3 additions & 3 deletions apimanager/locale/hi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1054,12 +1054,12 @@ msgstr "MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NE
#: metrics/templates/metrics/quarterly_summary.html:108
#: metrics/templates/metrics/weekly_summary.html:106
#: metrics/templates/metrics/yearly_summary.html:106
msgid "Apps with distinct names"
msgid "New apps with distinct names"
msgstr "MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 00 HOURS 04 MINUTES 16 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE"

#: metrics/templates/metrics/custom_summary.html:115
#: metrics/templates/metrics/monthly_summary.html:118
msgid "Distinct developer email addresses"
msgid "New distinct developer email addresses"
msgstr "MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 00 HOURS 04 MINUTES 16 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE"

#: metrics/templates/metrics/custom_summary.html:120
Expand Down Expand Up @@ -1171,7 +1171,7 @@ msgstr "MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NE
#: metrics/templates/metrics/hourly_summary.html:110
#: metrics/templates/metrics/quarterly_summary.html:112
#: metrics/templates/metrics/weekly_summary.html:110
msgid "Apps with distinct developer email addresses"
msgid "Apps with New distinct developer email addresses"
msgstr "MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 00 HOURS 04 MINUTES 02 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE"

#: metrics/templates/metrics/hourly_summary.html:20
Expand Down
2 changes: 1 addition & 1 deletion apimanager/metrics/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class APIMetricsForm(MetricsForm):

consumer_id = forms.ChoiceField(
label=_('Consumer ID'),
widget=forms.Select(
widget=forms.TextInput(
attrs={
'class': FORM_CONTROL,
}
Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/custom_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ <h2>{% trans "Custom Date Range " %}</h2>
<td>{% trans "Average response time (ms)" %}:</td>
<td>{{ average_response_time }}</td>
</tr>
<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Distinct developer email addresses" %}:</td>
<td>{% trans "New distinct developer email addresses" %}:</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/daily_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ <h2>{% if include_app_names != "" %} {{ include_app_names }} : {% endif %}{{ fro
<td>{{ average_response_time }}</td>
</tr>

<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Apps with distinct developer email addresses" %}:</td>
<td>{% trans "Apps with New distinct developer email addresses" %}:</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/hourly_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ <h2>{% if include_app_names != "" %} {{ include_app_names }} : {% endif %}{{ fro
<td>{{ average_response_time }}</td>
</tr>

<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Apps with distinct developer email addresses" %}:</td>
<td>{% trans "Apps with New distinct developer email addresses" %}:</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/monthly_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ <h2>{% if include_app_names != "" %} {{ include_app_names }} : {% endif %}{{ fro
<td>{% trans "Average response time (ms)" %}:</td>
<td>{{ average_response_time }}</td>
</tr>
<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Distinct developer email addresses" %}:</td>
<td>{% trans "New distinct developer email addresses" %}:</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/quarterly_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ <h2>{% if include_app_names != "" %} {{ include_app_names }} : {% endif %}{{ fro
<td>{{ average_response_time }}</td>
</tr>

<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Apps with distinct developer email addresses" %}:</td>
<td>{% trans "Apps with New distinct developer email addresses" %}:</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/weekly_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ <h2>{% if include_app_names != "" %} {{ include_app_names }} : {% endif %}{{ fro
<td>{{ average_response_time }}</td>
</tr>

<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Apps with distinct developer email addresses" %}:</td>
<td>{% trans "Apps with New distinct developer email addresses" %}:</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
12 changes: 6 additions & 6 deletions apimanager/metrics/templates/metrics/yearly_summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ <h2>{% if include_app_names != "" %} {{ include_app_names }} : {% endif %}{{ fro
<td>{{ average_response_time }}</td>
</tr>

<tr>
<td>{% trans "Median time from consumer registration to first API call" %}:</td>
<td>{{ median_time_to_first_api_call }}</td>
</tr>
{# <tr>#}
{# <td>{% trans "Median time from consumer registration to first API call" %}:</td>#}
{# <td>{{ median_time_to_first_api_call }}</td>#}
{# </tr>#}

<tr>
<td>{% trans "Apps with distinct names" %}:</td>
<td>{% trans "New apps with distinct names" %}:</td>
<td>{{ number_of_apps_with_unique_app_name }}</td>
</tr>
<tr>
<td>{% trans "Apps with distinct developer email addresses:" %}</td>
<td>{% trans "Apps with New distinct developer email addresses:" %}</td>
<td>{{ number_of_apps_with_unique_developer_email }}</td>
</tr>

Expand Down
Loading

0 comments on commit b2ffa95

Please sign in to comment.