Skip to content

Commit ad916ce

Browse files
Layout verbeteren #912
1 parent 0a0b500 commit ad916ce

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

dsmr_frontend/templates/dsmr_frontend/dashboard.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,23 @@
9494
<br>
9595
{% endif %}
9696

97-
{% if month_statistics and capabilities.any %}
97+
{% if capabilities.any %}
9898
<div class="row consumption-block">
9999
<div class="col-sm-12">
100100
<div class="panel">
101101
<header class="panel-heading">
102+
{% if month_statistics.electricity_merged or month_statistics.gas %}
102103
{% trans "Current month" %} <small>({% trans "until yesterday" %})</small>
104+
{% else %}
105+
{% trans "Current month" %}
106+
{% endif %}
103107

104108
<div class="pull-right">
105109
<a class="btn btn-sm btn-primary" href="{% url 'frontend:archive' %}"><i class="fas fa-chart-line"></i></a>
106110
</div>
107111
</header>
108112
<div class="panel-body">
113+
{% if month_statistics.electricity_merged or month_statistics.gas %}
109114
<table class="table table-hover">
110115
<tr>
111116
<th class="col-sm-6"></th>
@@ -149,6 +154,9 @@
149154
<td><span class="badge bg-black">{{ month_statistics.total_cost|default:'-' }}</span></td>
150155
</tr>
151156
</table>
157+
{% else %}
158+
<div class="graph_controls_help">{% blocktrans %}The totals for the current month are currently not (yet) available. Check again tomorrow.{% endblocktrans %}</div>
159+
{% endif %}
152160
</div>
153161
</div>
154162
</div>

dsmr_frontend/views/dashboard.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def get_context_data(self, **kwargs):
3030
context_data['consumption'] = dsmr_consumption.services.day_consumption(
3131
day=timezone.localtime(latest_electricity.read_at).date()
3232
)
33-
34-
today = timezone.localtime(timezone.now()).date()
35-
context_data['month_statistics'] = dsmr_stats.services.month_statistics(target_date=today)
33+
context_data['month_statistics'] = dsmr_stats.services.month_statistics(
34+
target_date=timezone.localtime(timezone.now()).date()
35+
)
3636

3737
return context_data
207 Bytes
Binary file not shown.

dsmrreader/locales/nl/LC_MESSAGES/django.po

+3
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,9 @@ msgstr "Huidige maand"
11891189
msgid "until yesterday"
11901190
msgstr "tot en met gisteren"
11911191

1192+
msgid "The totals for the current month are currently not (yet) available. Check again tomorrow."
1193+
msgstr "De totalen voor de huidige maand zijn momenteel (nog) niet beschikbaar. Probeer het morgen nogmaals."
1194+
11921195
msgid "/hour"
11931196
msgstr "/uur"
11941197

0 commit comments

Comments
 (0)