Skip to content
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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

TrudeauOkech
Copy link
Contributor

Fixes #2553

Added the following team metrics to break speaker ties.
Team wins
Number of 1sts
Number of seconds
Number of 3rds
Votes/ballots

Comment on lines 99 to 109
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)
Copy link
Member

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.

Copy link
Member

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this works too!

@TrudeauOkech TrudeauOkech changed the title Added team metrics to speakers Add team metrics to speakers Jan 3, 2025
@tienne-B tienne-B force-pushed the add-team-metrics-to-speakers branch from 9911847 to 72aff35 Compare January 14, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add team ranking metrics for speakers
2 participants