Reduce complexity of the validation of a user, add verbosity in comments

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-06-14 21:43:04 +02:00
parent c3ab61bd04
commit 8cf9dfb9b9
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 9 additions and 10 deletions

View File

@ -282,20 +282,19 @@ class FutureUserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, FormMixin,
fee = 0 fee = 0
bde = Club.objects.get(name="BDE") bde = Club.objects.get(name="BDE")
bde_fee = bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid bde_fee = bde.membership_fee_paid if user.profile.paid else bde.membership_fee_unpaid
if join_bde: # This is mandatory.
fee += bde_fee fee += bde_fee if join_bde else 0
kfet = Club.objects.get(name="Kfet") kfet = Club.objects.get(name="Kfet")
kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid kfet_fee = kfet.membership_fee_paid if user.profile.paid else kfet.membership_fee_unpaid
if join_kfet: # Add extra fee for the full membership
fee += kfet_fee fee += kfet_fee if join_kfet else 0
if soge: # If the bank pays, then we don't credit now. Treasurers will validate the transaction
# If the bank pays, then we don't credit now. Treasurers will validate the transaction # and credit the note later.
# and credit the note later. credit_type = None if soge else credit_type
credit_type = None
if credit_type is None: # If the user does not select any payment method, then no credit will be performed.
credit_amount = 0 credit_amount = 0 if credit_type is None else credit_amount
if fee > credit_amount and not soge: if fee > credit_amount and not soge:
# Check if the user credits enough money # Check if the user credits enough money