1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-22 23:42:25 +00:00

update hardcoded

This commit is contained in:
mcngnt 2024-09-10 19:37:12 +02:00 committed by korenstin
parent 185a2cabf2
commit 178ce2b579

View File

@ -276,7 +276,7 @@ class WEISurveyAlgorithm2024(WEISurveyAlgorithm):
surveys = list(self.get_survey_class()(r) for r in self.get_registrations()) # All surveys
surveys = [s for s in surveys if s.is_complete()] # Don't consider invalid surveys
# Don't manage hardcoded people
surveys = [s for s in surveys if not hasattr(s.information, 'hardcoded') or not s.information.hardcoded]
surveys = [s for s in surveys if s.registration.bus is not None]
# Reset previous algorithm run
for survey in surveys:
@ -290,10 +290,7 @@ class WEISurveyAlgorithm2024(WEISurveyAlgorithm):
registrations = self.get_registrations()
non_men_total = registrations.filter(~Q(gender='male')).count()
for bus in self.get_buses():
free_seats = bus.size - WEIMembership.objects.filter(bus=bus, registration__first_year=False).count()
# Remove hardcoded people
free_seats -= WEIMembership.objects.filter(bus=bus, registration__first_year=True,
registration__information_json__icontains="hardcoded").count()
free_seats = bus.size - WEIMembership.objects.filter(bus=bus).count()
quotas[bus] = 4 + int(non_men_total / registrations.count() * free_seats)
tqdm_obj = None
@ -306,11 +303,8 @@ class WEISurveyAlgorithm2024(WEISurveyAlgorithm):
quotas = {}
for bus in self.get_buses():
free_seats = bus.size - WEIMembership.objects.filter(bus=bus, registration__first_year=False).count()
free_seats = bus.size - WEIMembership.objects.filter(bus=bus).count()
free_seats -= sum(1 for s in non_men if s.information.selected_bus_pk == bus.pk)
# Remove hardcoded people
free_seats -= WEIMembership.objects.filter(bus=bus, registration__first_year=True,
registration__information_json__icontains="hardcoded").count()
quotas[bus] = free_seats
if display_tqdm: