Skip to content

Commit

Permalink
fix: bunking algorithm not factoring in cancelled sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
hrideshmg committed Oct 16, 2024
1 parent 72a8f78 commit 7eb88bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def percentage(self):
return round(present_count / (present_count + bunked_count) * 100)

def bunks_available(self):
total_sessions = self.sessions.count()
total_sessions = self.sessions.exclude(status="cancelled").count()
must_attend = math.ceil((total_sessions * self.collection.threshold) / 100)
total_bunks_available = total_sessions - must_attend
bunked_sessions = self.sessions.filter(status="bunked").count()
Expand Down

0 comments on commit 7eb88bb

Please sign in to comment.