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

Power Rankings Break for Leagues with Deleted Members #55

Open
dmrickert opened this issue Sep 25, 2018 · 0 comments
Open

Power Rankings Break for Leagues with Deleted Members #55

dmrickert opened this issue Sep 25, 2018 · 0 comments

Comments

@dmrickert
Copy link

TL;DR deleted members mess up the matrix math so your dominance matrix and thus power rankings won't be correct

My league has been ongoing since 2016. Since then we've had to delete two members, but in ESPN they still retain that team id (6 and 8 in my case). When the code goes to develop the win matrices for the power rankings, it loops through the teams_sorted array: "for team in teams_sorted:"

The teams_sorted array correctly ignores the deleted teams. However, the win matrix is built upon opponent.team_id, so the team_id for 6 and 8 (array position 5 and 7) still exists. That outputs a matrix with rows != columns (rows follow teams_sorted list, columns follow opponent.team_id). Then, the matrix math uses len(X) where X is the win_matrix for its loops. len(X) gives you the number of rows in the matrix (since a matrix in python is really just a list of list). In my case, this meant that any wins against the two newer teams were ignored because there were 12 rows but 14 columns and the last 2 columns were the 2 newer members.

Sorry for the wall of text, but I was trying to step through to make it clear. I'll see if I can get a PR in but if someone else gets to this before me it's all theirs

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

No branches or pull requests

1 participant