From 4c8a57b0d9af39c96432a5687f185427bfe966b3 Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Tue, 25 Aug 2015 15:45:19 -0300 Subject: [PATCH] Force the map to display only Servico that remains active --- sigi/apps/metas/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sigi/apps/metas/views.py b/sigi/apps/metas/views.py index 675704b..cf89a42 100644 --- a/sigi/apps/metas/views.py +++ b/sigi/apps/metas/views.py @@ -288,7 +288,7 @@ def gera_map_data_file(cronjob=False): casas = {} - for c in CasaLegislativa.objects.select_related('servico', 'convenio', 'diagnostico').all().distinct(): + for c in CasaLegislativa.objects.prefetch_related('servico_set', 'convenio_set', 'diagnostico_set').all().distinct(): if c.servico_set.count() == 0 and c.convenio_set.count() == 0 and c.diagnostico_set.count() == 0: continue # Salta essa casa, pois ela não tem nada com o Interlegis @@ -334,7 +334,7 @@ def parliament_summary(parliament): 'info': [] } - for sv in parliament.servico_set.all(): + for sv in parliament.servico_set.filter(data_desativacao=None): summary['info'].append( _(u"%(name)s ativado em %(date)s") % dict( name=sv.tipo_servico.nome,