Fixed shuttle count

This commit is contained in:
John Mullins
2024-12-13 09:49:12 +11:00
parent dabce7f360
commit 034b9f7d91
3 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -112,8 +112,12 @@ class Shuttle(models.Model):
custom_name = ""
return f"{self.school.shortName} <-> {self.bus.route_name}{custom_name}"
def traveller_count(self):
return Traveller.objects.filter(shuttle=self, is_active=True).count()
def traveller_count(self, date=None):
count = 0
for traveller in Traveller.objects.filter(shuttle=self):
if traveller._is_active(date):
count += 1
return count
class Driver(models.Model):