From 57d964681b83c917ec37a9c91a113cfe672b2822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 21 Oct 2014 23:10:24 -0200 Subject: [PATCH] Add dropdown info in Servicos SEIT dashboard display --- sigi/context_processors.py | 6 ++++++ templates/snippets/modules/charts-convenios.html | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sigi/context_processors.py b/sigi/context_processors.py index bcd0936..6a34092 100644 --- a/sigi/context_processors.py +++ b/sigi/context_processors.py @@ -165,11 +165,17 @@ def busca_informacoes_seit(): 'novos_mes_atual': 'Novas casas em %s/%s' % (mes_atual.month, mes_atual.year)}] for tipo_servico in TipoServico.objects.all(): + por_mes = [] + for mes in range(1,13): + por_mes.append({'mes': '%s/%s' % (mes,datetime.date.today().year), + 'total': tipo_servico.servico_set.filter(data_desativacao=None, data_ativacao__year=mes_atual.year, data_ativacao__month=mes).count()}) + result.append( {'nome': tipo_servico.nome, 'total': tipo_servico.servico_set.filter(data_desativacao=None).count(), 'novos_mes_anterior': tipo_servico.servico_set.filter(data_desativacao=None, data_ativacao__year=mes_anterior.year, data_ativacao__month=mes_anterior.month).count(), 'novos_mes_atual': tipo_servico.servico_set.filter(data_desativacao=None, data_ativacao__year=mes_atual.year, data_ativacao__month=mes_atual.month).count(), + 'novos_por_mes': por_mes, } ) diff --git a/templates/snippets/modules/charts-convenios.html b/templates/snippets/modules/charts-convenios.html index 352e1e8..37186e3 100644 --- a/templates/snippets/modules/charts-convenios.html +++ b/templates/snippets/modules/charts-convenios.html @@ -64,7 +64,16 @@ {{ servico.novos_mes_anterior }} {{ servico.novos_mes_atual }} {% else %} - {{ servico.nome }} + + + {{ servico.nome }} + + + {% for mes in servico.novos_por_mes %} + + {% endfor %} + + {{ servico.total }} {{ servico.novos_mes_anterior }} {{ servico.novos_mes_atual }}