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"><i class="fas fa-envelope fa-3x"></i></p>
<p class="card-text text-dark"> <p class="card-text text-dark">
{{ domain.mails|length }} {% trans "mail addresses created" %} {{ domain.mails|length }} {% trans "mail addresses created" %}
{% if domain.address_left.alert %} {% if domain.address_left.alert_level %}
<br/> <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 %} {% endif %}
</p> </p>
<a class="stretched-link" href="{% url 'musician:mails' %}?domain={{ domain.id }}"></a> <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 # TODO(@slamora): validate concept of limits with Pangea
profile_type = context['profile'].type profile_type = context['profile'].type
for domain in domains: for domain in domains:
address_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails) addresses_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails)
alert = None alert_level = None
if address_left == 1: if addresses_left == 1:
alert = 'warning' alert_level = 'warning'
elif address_left < 1: elif addresses_left < 1:
alert = 'danger' alert_level = 'danger'
domain.address_left = { domain.addresses_left = {
'count': address_left, 'count': addresses_left,
'alert': alert, 'alert_level': alert_level,
} }
context.update({ context.update({