- {% if not registration.deposit_check and not registration.first_year and registration.caution_type == 'check' %}
+ {% if not registration.deposit_given and not registration.first_year and registration.caution_type == 'check' %}
- {% trans "The user didn't give her/his caution check." %}
+ {% trans "The user didn't give her/his caution." %}
{% endif %}
diff --git a/apps/wei/tests/test_wei_algorithm_2025.py b/apps/wei/tests/test_wei_algorithm_2025.py
index 883b6e5a..912f0e90 100644
--- a/apps/wei/tests/test_wei_algorithm_2025.py
+++ b/apps/wei/tests/test_wei_algorithm_2025.py
@@ -126,7 +126,8 @@ class TestWEIAlgorithm(TestCase):
for r2 in WEIRegistration.objects.filter(wei=self.wei, pk__gt=r1.pk):
survey2 = WEISurvey2025(r2)
bus2 = survey2.information.get_selected_bus()
-
+
prefer_switch_bus_words = survey1.score_words(bus2) > survey1.score_words(bus1) and survey2.score_words(bus1) > survey2.score_words(bus2)
- prefer_switch_bus_questions = survey1.score_questions(bus2) > survey1.score_questions(bus1) and survey2.score_questions(bus1) > survey2.score_questions(bus2)
- self.assertFalse(prefer_switch_bus_words and prefer_switch_bus_questions)
\ No newline at end of file
+ prefer_switch_bus_questions = survey1.score_questions(bus2) > survey1.score_questions(bus1) and\
+ survey2.score_questions(bus1) > survey2.score_questions(bus2)
+ self.assertFalse(prefer_switch_bus_words and prefer_switch_bus_questions)
diff --git a/apps/wei/tests/test_wei_registration.py b/apps/wei/tests/test_wei_registration.py
index 185ee374..ca8f08e9 100644
--- a/apps/wei/tests/test_wei_registration.py
+++ b/apps/wei/tests/test_wei_registration.py
@@ -101,7 +101,7 @@ class TestWEIRegistration(TestCase):
user_id=self.user.id,
wei_id=self.wei.id,
soge_credit=True,
- deposit_check=True,
+ deposit_given=True,
birth_date=date(2000, 1, 1),
gender="nonbinary",
clothing_cut="male",
@@ -642,7 +642,7 @@ class TestWEIRegistration(TestCase):
last_name="admin",
first_name="admin",
bank="Société générale",
- deposit_check=True,
+ deposit_given=True,
))
self.assertEqual(response.status_code, 200)
self.assertFalse(response.context["form"].is_valid())
@@ -657,7 +657,7 @@ class TestWEIRegistration(TestCase):
last_name="admin",
first_name="admin",
bank="Société générale",
- deposit_check=True,
+ deposit_given=True,
))
self.assertRedirects(response, reverse("wei:wei_registrations", kwargs=dict(pk=self.registration.wei.pk)), 302, 200)
@@ -813,7 +813,7 @@ class TestWeiAPI(TestAPI):
user_id=self.user.id,
wei_id=self.wei.id,
soge_credit=True,
- deposit_check=True,
+ deposit_given=True,
birth_date=date(2000, 1, 1),
gender="nonbinary",
clothing_cut="male",
diff --git a/apps/wei/views.py b/apps/wei/views.py
index d180d3d9..1fa6e4e0 100644
--- a/apps/wei/views.py
+++ b/apps/wei/views.py
@@ -594,8 +594,8 @@ class WEIRegister1AView(ProtectQuerysetMixin, ProtectedCreateView):
# Cacher les champs pendant l'inscription initiale
if "first_year" in form.fields:
del form.fields["first_year"]
- if "deposit_check" in form.fields:
- del form.fields["deposit_check"]
+ if "deposit_given" in form.fields:
+ del form.fields["deposit_given"]
if "information_json" in form.fields:
del form.fields["information_json"]
if "deposit_type" in form.fields:
@@ -704,8 +704,8 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView):
# Cacher les champs pendant l'inscription initiale
if "first_year" in form.fields:
del form.fields["first_year"]
- if "deposit_check" in form.fields:
- del form.fields["deposit_check"]
+ if "deposit_given" in form.fields:
+ del form.fields["deposit_given"]
if "information_json" in form.fields:
del form.fields["information_json"]
@@ -806,9 +806,9 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
# The auto-json-format may cause issues with the default field remove
if "information_json" in form.fields:
del form.fields["information_json"]
- # Masquer le champ deposit_check pour tout le monde dans le formulaire de modification
- if "deposit_check" in form.fields:
- del form.fields["deposit_check"]
+ # Masquer le champ deposit_given pour tout le monde dans le formulaire de modification
+ if "deposit_given" in form.fields:
+ del form.fields["deposit_given"]
# S'assurer que le champ deposit_type est obligatoire pour les 2A+
if "deposit_type" in form.fields:
@@ -818,6 +818,14 @@ class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Update
form.fields["deposit_type"].required = True
form.fields["deposit_type"].help_text = _("Choose how you want to pay the deposit")
+ if not self.object.first_year and self.object.deposit_type == 'check':
+ form.fields["deposit_given"] = forms.BooleanField(
+ required=False,
+ initial=self.object.deposit_given,
+ label=_("Deposit check given"),
+ help_text=_("Tick if the deposit check has been given")
+ )
+
if self.object.user.profile.soge:
form.fields["soge_credit"].disabled = True
form.fields["soge_credit"].help_text = _("You already opened an account in the Société générale.")
@@ -1016,17 +1024,18 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
form.fields["last_name"].initial = registration.user.last_name
form.fields["first_name"].initial = registration.user.first_name
- # Ajouter le champ deposit_check uniquement pour les non-première année et le rendre obligatoire
+ # Ajouter le champ deposit_given uniquement pour les non-première année et le rendre obligatoire
if not registration.first_year:
if registration.deposit_type == 'check':
- form.fields["deposit_check"] = forms.BooleanField(
+ form.fields["deposit_given"] = forms.BooleanField(
required=True,
- initial=registration.deposit_check,
+ disabled=True,
+ initial=registration.deposit_given,
label=_("Deposit check given"),
- help_text=_("Please make sure the check is given before validating the registration")
+ help_text=_("Only treasurers can validate this field")
)
else:
- form.fields["deposit_check"] = forms.BooleanField(
+ form.fields["deposit_given"] = forms.BooleanField(
required=True,
initial=False,
label=_("Create deposit transaction"),
@@ -1067,8 +1076,8 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
club = registration.wei
user = registration.user
- if "deposit_check" in form.data:
- registration.deposit_check = form.data["deposit_check"] == "on"
+ if "deposit_given" in form.data:
+ registration.deposit_given = form.data["deposit_given"] == "on"
registration.save()
membership = form.instance
membership.user = user
@@ -1180,7 +1189,7 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
def form_invalid(self, form):
registration = getattr(form.instance, "registration", None)
if registration is not None:
- registration.deposit_check = False
+ registration.deposit_given = False
registration.save()
return super().form_invalid(form)