1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

[WEI] Fix quotas

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-09-16 21:10:23 +02:00
parent 1ef25924a0
commit 9583cec3ff
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -204,13 +204,21 @@ class WEISurveyAlgorithm2021(WEISurveyAlgorithm):
# Repartition for non men people first
self.make_repartition(non_men, quotas, tqdm_obj=tqdm_obj)
quotas = {}
for bus in self.get_buses():
free_seats = bus.size - WEIMembership.objects.filter(bus=bus, registration__first_year=False).count()
free_seats -= sum(1 for s in non_men if s.information.selected_bus_pk == bus.pk)
quotas[bus] = free_seats
print(quotas)
if display_tqdm:
tqdm_obj.close()
from tqdm import tqdm
tqdm_obj = tqdm(total=len(men), desc="Hommes")
self.make_repartition(men, tqdm_obj=tqdm_obj)
self.make_repartition(men, quotas, tqdm_obj=tqdm_obj)
if display_tqdm:
tqdm_obj.close()