Make more descriptive variable names.

This commit is contained in:
Santiago Lamora 2020-01-20 10:20:26 +01:00
parent 90ad13e61a
commit 6980522d81
2 changed files with 11 additions and 11 deletions

View File

@ -62,9 +62,9 @@
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
<p class="card-text text-dark">
{{ domain.mails|length }} {% trans "mail addresses created" %}
{% if domain.address_left.alert %}
{% if domain.address_left.alert_level %}
<br/>
<span class="text-{{ domain.address_left.alert }}">{{ domain.address_left.count }} mail address left</span>
<span class="text-{{ domain.address_left.alert_level }}">{{ domain.address_left.count }} mail address left</span>
{% endif %}
</p>
<a class="stretched-link" href="{% url 'musician:mails' %}?domain={{ domain.id }}"></a>

View File

@ -66,16 +66,16 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
# TODO(@slamora): validate concept of limits with Pangea
profile_type = context['profile'].type
for domain in domains:
address_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails)
alert = None
if address_left == 1:
alert = 'warning'
elif address_left < 1:
alert = 'danger'
addresses_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails)
alert_level = None
if addresses_left == 1:
alert_level = 'warning'
elif addresses_left < 1:
alert_level = 'danger'
domain.address_left = {
'count': address_left,
'alert': alert,
domain.addresses_left = {
'count': addresses_left,
'alert_level': alert_level,
}
context.update({