Browse Source

Pequenas correções

pull/1596/head
João Pedro Sconetto 7 years ago
committed by Marcio Mazza
parent
commit
4063760b5f
  1. 8
      sapl/legacy/migra_autor.py

8
sapl/legacy/migra_autor.py

@ -19,8 +19,8 @@ def migra_autor(db, passwd):
for author in all_authors: for author in all_authors:
query2 = ("select * from {}.autor \ query2 = ("select * from {}.autor \
where cod_parlamentar = " + str(author[0]) + " \ where cod_parlamentar = {} \
group by cod_autor;").format(db) group by cod_autor;").format(db, str(author[0]))
cursor.execute(query2) cursor.execute(query2)
user = [] user = []
@ -30,6 +30,7 @@ def migra_autor(db, passwd):
ativ = [] ativ = []
inativ = [] inativ = []
for tupl in user: for tupl in user:
# tupl[8] = ind_excluido
if tupl[8] == 1: if tupl[8] == 1:
inativ.append(tupl) inativ.append(tupl)
elif tupl[8] == 0: elif tupl[8] == 0:
@ -43,10 +44,11 @@ def migra_autor(db, passwd):
inativIds = [u[0] for u in inativ] inativIds = [u[0] for u in inativ]
inativIds = (str(inativIds)).replace(']', ')').replace('[', '(') inativIds = (str(inativIds)).replace(']', ')').replace('[', '(')
query3 += inativIds + ';' query3 += inativIds + ';'
#cursor.execute(query3) cursor.execute(query3)
query4 = ("delete from sapl_cm_ere_cpy.autor \ query4 = ("delete from sapl_cm_ere_cpy.autor \
where cod_autor in ") where cod_autor in ")
query4 += inativIds + ';' query4 += inativIds + ';'
cursor.execute(query4)

Loading…
Cancel
Save