Commit 44ad1256 authored by root's avatar root
Browse files

Fix non acked alarms calculation

parent c25ee3a1
......@@ -20,7 +20,7 @@
{% for d in data %}
<tr>
<td>
{% if d.school.get_non_acked_alarms %}<i class="fa fa-times" aria-hidden="true" style="color:red;"></i>
{% if d.get_non_acked_alarms %}<i class="fa fa-times" aria-hidden="true" style="color:red;"></i>
{% else %}<i class="fa fa-check" aria-hidden="true" style="color:green;"></i>
{% endif %}
</td>
......
......@@ -425,7 +425,17 @@ def school_log(request):
if not request.user.is_superuser:
messages.error(request, _("You don't have the permissions to see this data"))
return HttpResponseRedirect(reverse('home'))
data = smodels.SchoolKeyUsage.objects.filter(school__dismissed=False).values("school__name", "school__pk").annotate(last=Max("timestamp")).order_by("last")
_data = smodels.SchoolKeyUsage.objects.filter(school__dismissed=False).values("school__name", "school__pk").annotate(last=Max("timestamp")).order_by("last")
data = []
for x in _data:
school = smodels.School.objects.get(pk=x["school__pk"])
class School(object):
school__name = x["school__name"]
school__pk = x["school__pk"]
last = x["last"]
get_non_acked_alarms = school.get_non_acked_alarms
data.append(School())
return render(request, 'schools/school_log.html', {
'data': data
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment