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

Rankings generator crashes when only one metric in precedence #749

Closed
czlee opened this issue Aug 13, 2018 · 0 comments
Closed

Rankings generator crashes when only one metric in precedence #749

czlee opened this issue Aug 13, 2018 · 0 comments
Assignees
Labels
bugs Reported/reproduced bugs
Milestone

Comments

@czlee
Copy link
Member

czlee commented Aug 13, 2018

BACKEND-VR: https://sentry.io/tabbycat-ig/backend/issues/645557194/

I think it crashes because when trying to generate a subrank, it looks for metrics[1:], which is an empty list whenever the team standings precedence has only one element in it.

TypeError: itemgetter expected 1 arguments, got 0
(9 additional frame(s) were not displayed)
...
  File "draw/manager.py", line 191, in get_teams
    generator = TeamStandingsGenerator(metrics, ('rank', 'subrank'), tiebreak="random")
  File "standings/base.py", line 294, in __init__
    self._interpret_rankings(rankings)
  File "standings/base.py", line 393, in _interpret_rankings
    annotator = klass(self.precedence)
  File "standings/ranking.py", line 97, in __init__
    self.rank_key = metricgetter(*metrics[1:])
  File "standings/metrics.py", line 23, in metricgetter
    metricitemgetter = itemgetter(*items)

TypeError: itemgetter expected 1 arguments, got 0
@czlee czlee self-assigned this Aug 13, 2018
@czlee czlee added error-report bugs Reported/reproduced bugs and removed error-report labels Aug 13, 2018
@czlee czlee added this to the Hotfixes milestone Aug 13, 2018
@philipbelesky philipbelesky added waiting-contributor awaiting maintainer Issues/PRs waiting on a maintainer and removed waiting-contributor labels Aug 19, 2018
@czlee czlee closed this as completed in 47dd635 Aug 21, 2018
@czlee czlee removed the awaiting maintainer Issues/PRs waiting on a maintainer label Aug 21, 2018
czlee added a commit that referenced this issue Aug 21, 2018
Two changes, both of which prevent crashing. The change in
standings/metrics.py prevents the lower level from crashing, and
the change in draw/views.py hides what is then a redundant column.
czlee added a commit that referenced this issue Aug 21, 2018
Two changes, both of which prevent crashing. The change in
standings/metrics.py prevents the lower level from crashing, and
the change in draw/views.py hides what is then a redundant column.

(cherry picked from commit 47dd635)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Reported/reproduced bugs
Projects
None yet
Development

No branches or pull requests

2 participants