1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-08-04 22:33:40 +02:00

Merge branch 'wei' into 'main'

Wei

See merge request bde/nk20!338
This commit is contained in:
ehouarn
2025-08-03 01:38:27 +02:00
11 changed files with 211 additions and 46 deletions

View File

@@ -44,7 +44,7 @@ class WEIRegistrationForm(forms.ModelForm):
fields = [
'user', 'soge_credit', 'birth_date', 'gender', 'clothing_size',
'health_issues', 'emergency_contact_name', 'emergency_contact_phone',
'first_year', 'information_json', 'deposit_check', 'deposit_type'
'first_year', 'information_json', 'deposit_given', 'deposit_type'
]
widgets = {
"user": Autocomplete(
@@ -59,8 +59,8 @@ class WEIRegistrationForm(forms.ModelForm):
'minDate': '1900-01-01',
'maxDate': '2100-01-01'
}),
"deposit_check": forms.BooleanField(
required=False,
"deposit_given": forms.CheckboxInput(
attrs={'class': 'form-check-input'},
),
"deposit_type": forms.RadioSelect(),
}
@@ -161,7 +161,7 @@ class WEIMembership1AForm(WEIMembershipForm):
"""
Used to confirm registrations of first year members without choosing a bus now.
"""
deposit_check = None
deposit_given = None
roles = None
def clean(self):

View File

@@ -386,7 +386,7 @@ class WEISurvey2025(WEISurvey):
bus_info = self.get_algorithm_class().get_bus_information(bus)
# Score is the given score by the bus subtracted to the mid-score of the buses.
s = sum(bus_info.scores[getattr(self.information, 'word' + str(i))]
- self.word_mean(getattr(self.information, 'word' + str(i))) for i in range(1, 1 + NB_WORDS))
- self.word_mean(getattr(self.information, 'word' + str(i))) for i in range(1, 1 + NB_WORDS)) / self.get_algorithm_class().get_buses().count()
return s
@lru_cache()
@@ -399,7 +399,7 @@ class WEISurvey2025(WEISurvey):
Force the choice of bus to be in the 3 preferred buses according to the words
"""
values = list(self.scores_per_bus().items())
values.sort(key=lambda item: -item[1][1])
values.sort(key=lambda item: -item[1][0])
return values
@classmethod
@@ -514,7 +514,7 @@ class WEISurveyAlgorithm2025(WEISurveyAlgorithm):
if not survey2.information.valid or survey2.information.get_selected_bus() != bus:
continue
score2 = survey2.score_questions(bus)
if current_scores[0] <= score2: # Ignore better students
if current_scores[1] <= score2: # Ignore better students
continue
if least_preferred_survey is None or score2 < least_score:
least_preferred_survey = survey2