1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2024-12-26 01:12:25 +00:00

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

View File

@ -185,6 +185,7 @@ class Command(ImportCommand):
n = cur.rowcount
pk_membership = 1
pk_transaction = 1
kfet_balance = 0
for idx, row in enumerate(cur):
if save or idx % chunk_size == 0:
self.update_line(idx, n, row["description"])
@ -261,6 +262,7 @@ class Command(ImportCommand):
}
obj_dict0["amount"] = bde_dict["fee"]
obj_dict["amount"] = kfet_dict["fee"]
kfet_balance += kfet_dict["fee"]
# BDE membership Transaction is inserted before the Kfet membershipTransaction
pk_membership += 1
pk_transaction += 1
@ -291,6 +293,14 @@ class Command(ImportCommand):
pk_transaction += 1
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
def set_roles(self):
bulk_mgr = BulkCreateManager(chunk_size=10000)