From 78eb51ff5d587d841f182822308f7cfe6bf2cd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 8 Jun 2021 20:11:31 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20bug=20no=20filtro=20d?= =?UTF-8?q?o=20mapa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/metas/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sigi/apps/metas/views.py b/sigi/apps/metas/views.py index 04a9bfc..6a8f9c9 100644 --- a/sigi/apps/metas/views.py +++ b/sigi/apps/metas/views.py @@ -190,7 +190,7 @@ def openmapdata(request): if not reptype: - dados = dados.distinct("nome") + dados = dados.order_by('nome', 'id').distinct('nome', 'id') dados = dados.values_list("id", "nome", "municipio__latitude", "municipio__longitude") return JsonResponse(list(dados), safe=False) @@ -198,11 +198,13 @@ def openmapdata(request): dados = dados.order_by( 'municipio__uf__regiao', 'municipio__uf__nome', - 'nome' + 'nome', + 'id' ).distinct( 'municipio__uf__regiao', 'municipio__uf__nome', - 'nome' + 'nome', + 'id' ).prefetch_related( 'servico_set', 'convenio_set',