[WEI] Extreme test with full buses and quality constraints
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
451851c955
commit
74ab4df9fe
3 changed files with 49 additions and 3 deletions
|
|
@ -53,7 +53,8 @@ class WEIBusInformation:
|
|||
def free_seats(self, surveys: List["WEISurvey"] = None):
|
||||
size = self.bus.size
|
||||
already_occupied = WEIMembership.objects.filter(bus=self.bus).count()
|
||||
valid_surveys = sum(1 for survey in surveys if survey.information.valid) if surveys else 0
|
||||
valid_surveys = sum(1 for survey in surveys if survey.information.valid
|
||||
and survey.information.get_selected_bus() == self.bus) if surveys else 0
|
||||
return size - already_occupied - valid_surveys
|
||||
|
||||
def has_free_seats(self, surveys=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue