Skip to content

Commit 8e0d299

Browse files
author
Nik Sauer
committed
campaign detail view display None as - with gray background
1 parent 7a5ed74 commit 8e0d299

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

app/campaign/templatetags/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ def at(l, id):
1414
@register.filter
1515
def to_rgb(tup):
1616
if tup is None:
17-
return '80, 80, 80'
17+
return '100, 100, 100'
1818
return ','.join([str(x) for x in tup])

app/campaign/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ def get_context_data(self, **kwargs):
7474
room_current_values = {}
7575
for room in campaign.rooms.all():
7676
room_current_values[room.pk] = room_calculate_current_values(room)
77-
77+
78+
print(room_current_values[room.pk])
79+
# for better dispaying set alle values that are None to '- '
80+
for i in range(0, len(room_current_values[room.pk]), 2):
81+
if room_current_values[room.pk][i] is None:
82+
room_current_values[room.pk][i] = '- '
83+
print(room_current_values[room.pk])
84+
7885
context['room_current_values'] = room_current_values
7986

8087
return context

app/main/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def get_current_mean(dimension):
115115
current_tvoc = get_current_mean(Dimension.TVOC)
116116
tvoc_color = Dimension.get_color(Dimension.TVOC, current_tvoc) if current_tvoc else None
117117

118-
return (
118+
return [
119119
current_temperature,
120120
temperature_color,
121121
current_pm2_5,
@@ -124,4 +124,4 @@ def get_current_mean(dimension):
124124
co2_color,
125125
current_tvoc,
126126
tvoc_color
127-
)
127+
]

0 commit comments

Comments
 (0)