This commit is contained in:
Pierre-antoine Comby 2020-05-10 17:40:58 +02:00
parent 98addc1db9
commit dc09532308
1 changed files with 5 additions and 6 deletions

View File

@ -173,12 +173,12 @@ def import_transaction(cur):
cur.execute( cur.execute(
"SELECT t.date AS transac_date, t.type, t.emetteur,\ "SELECT t.date AS transac_date, t.type, t.emetteur,\
t.destinataire,t.quantite, t.montant, t.description,\ t.destinataire,t.quantite, t.montant, t.description,\
t.valide, t.cantinvalidate, t.categorie \ t.valide, t.cantinvalidate, t.categorie, \
a.idbde, a.annee, a.wei, a.date AS adh_date, a.section\ a.idbde, a.annee, a.wei, a.date AS adh_date, a.section\
FROM transactions AS t \ FROM transactions AS t \
LEFT JOIN adhesions AS a ON t.id = a.idtransaction \ LEFT JOIN adhesions AS a ON t.id = a.idtransaction \
WHERE transactions.id> {} \ WHERE t.id> {} \
ORDER BY transactions.id;".format(idmin) ORDER BY t.id;".format(idmin)
) )
n = cur.rowcount n = cur.rowcount
for idx, row in enumerate(cur): for idx, row in enumerate(cur):
@ -193,7 +193,7 @@ def import_transaction(cur):
# "pk": row["id"], # "pk": row["id"],
"destination_id": MAP_IDBDE[row["destinataire"]], "destination_id": MAP_IDBDE[row["destinataire"]],
"source_id": MAP_IDBDE[row["emetteur"]], "source_id": MAP_IDBDE[row["emetteur"]],
"created_at": make_aware(date), "created_at": date,
"amount": row["montant"], "amount": row["montant"],
"quantity": row["quantite"], "quantity": row["quantite"],
"reason": row["description"], "reason": row["description"],
@ -303,7 +303,7 @@ def import_aliases(cur):
cur.execute("SELECT * FROM aliases ORDER by id") cur.execute("SELECT * FROM aliases ORDER by id")
n = cur.rowcount n = cur.rowcount
for idx, row in enumerate(cur): for idx, row in enumerate(cur):
update_line(idx, n, row["titre"]) update_line(idx, n, row["alias"])
alias_name = row["alias"] alias_name = row["alias"]
alias_name_good = (alias_name[:252] + '...') if len(alias_name) > 255 else alias_name alias_name_good = (alias_name[:252] + '...') if len(alias_name) > 255 else alias_name
obj_dict = { obj_dict = {
@ -469,7 +469,6 @@ class Command(BaseCommand):
parser.add_argument('-t', '--transactions', action='store_true', help="import transaction") parser.add_argument('-t', '--transactions', action='store_true', help="import transaction")
parser.add_argument('-al', '--aliases', action='store_true', help="import aliases") parser.add_argument('-al', '--aliases', action='store_true', help="import aliases")
parser.add_argument('-ac', '--activities', action='store_true', help="import activities") parser.add_argument('-ac', '--activities', action='store_true', help="import activities")
parser.add_argument('-M', '--memberships', action='store_true', help="import memberships")
parser.add_argument('-r', '--remittances', action='store_true', help="import check remittances") parser.add_argument('-r', '--remittances', action='store_true', help="import check remittances")
parser.add_argument('-s', '--save', action='store', help="save mapping of idbde") parser.add_argument('-s', '--save', action='store', help="save mapping of idbde")
parser.add_argument('-m', '--map', action='store', help="import mapping of idbde") parser.add_argument('-m', '--map', action='store', help="import mapping of idbde")