Update the balance of the Kfet club

This commit is contained in:
Yohann D'ANELLO 2020-08-01 15:16:36 +02:00
parent ceb7063f17
commit dd8b48c31d
1 changed files with 10 additions and 0 deletions

View File

@ -185,6 +185,7 @@ class Command(ImportCommand):
n = cur.rowcount n = cur.rowcount
pk_membership = 1 pk_membership = 1
pk_transaction = 1 pk_transaction = 1
kfet_balance = 0
for idx, row in enumerate(cur): for idx, row in enumerate(cur):
if save or idx % chunk_size == 0: if save or idx % chunk_size == 0:
self.update_line(idx, n, row["description"]) self.update_line(idx, n, row["description"])
@ -261,6 +262,7 @@ class Command(ImportCommand):
} }
obj_dict0["amount"] = bde_dict["fee"] obj_dict0["amount"] = bde_dict["fee"]
obj_dict["amount"] = kfet_dict["fee"] obj_dict["amount"] = kfet_dict["fee"]
kfet_balance += kfet_dict["fee"]
# BDE membership Transaction is inserted before the Kfet membershipTransaction # BDE membership Transaction is inserted before the Kfet membershipTransaction
pk_membership += 1 pk_membership += 1
pk_transaction += 1 pk_transaction += 1
@ -291,6 +293,14 @@ class Command(ImportCommand):
pk_transaction += 1 pk_transaction += 1
bulk_mgr.done() bulk_mgr.done()
# Update the balance of the BDE and the Kfet club
note_bde = NoteClub.objects.get(pk=5)
note_kfet = NoteClub.objects.get(pk=6)
note_bde.balance -= kfet_balance
note_kfet.balance += kfet_balance
note_bde.save()
note_kfet.save()
@timed @timed
def set_roles(self): def set_roles(self):
bulk_mgr = BulkCreateManager(chunk_size=10000) bulk_mgr = BulkCreateManager(chunk_size=10000)