From 24516b9fd4c15bbdaf98ed78f496c81f001b828a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Sconetto?= Date: Tue, 21 Nov 2017 15:31:38 -0200 Subject: [PATCH] Minor Fix --- sapl/legacy/migration.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index 140e9836c..60db7d433 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -186,8 +186,8 @@ def migra_autor(): SQL_ENUMERA_REPETIDOS = ''' select cod_parlamentar, COUNT(*) - from autor where col_username is not null - group by col_username, cod_parlamentar + from autor where cod_parlamentar is not null + group by cod_parlamentar having 1 < COUNT(*) order by cod_parlamentar asc; ''' @@ -195,7 +195,8 @@ def migra_autor(): SQL_INFOS_AUTOR = ''' select cod_autor from autor where cod_parlamentar = {} - group by cod_autor; + group by cod_autor + order by col_username, des_cargo desc; ''' SQL_UPDATE_AUTOR = "update autoria set cod_autor = {} where cod_autor in ({});" @@ -233,7 +234,7 @@ def migra_autor(): and cod_autor not in ({}); ''' - cursor = exec_legado('update autor set ind_excluido = 0;') + cursor = exec_legado('update autor set ind_excluido = 0 where cod_autor is not null;') cursor = exec_legado(SQL_ENUMERA_REPETIDOS) autores_parlamentares = [r[0] for r in cursor if r[0]]