-
-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add team metrics to speakers #2572
base: develop
Are you sure you want to change the base?
Add team metrics to speakers #2572
Conversation
tabbycat/standings/speakers.py
Outdated
def get_annotation(self, round): | ||
"""Returns a QuerySet annotated with the number of wins for the team of the speaker.""" | ||
annotation_filter = Q( | ||
team__debateteam__teamscore__ballot_submission__confirmed=True, | ||
team__debateteam__debate__round__stage=Round.Stage.PRELIMINARY, | ||
team__debateteam__teamscore__win=self.where_value, | ||
) | ||
if round is not None: | ||
annotation_filter &= Q(team__debateteam__debate__round__seq__lte=round.seq) | ||
|
||
return self.function('team__debateteam__teamscore__win', filter=annotation_filter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to create a superclass for these that abstracts these out, like what's done for teams.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I've pushed up a change to use a dedicated subclass rather than a big if
. Thoughts, @TrudeauOkech ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this works too!
9911847
to
72aff35
Compare
Fixes #2553
Added the following team metrics to break speaker ties.
Team wins
Number of 1sts
Number of seconds
Number of 3rds
Votes/ballots