nmelhado / league-page

Create a custom league page for your Sleeper fantasy football league!
legends-league.vercel.app
MIT License
225 stars 1.09k forks source link

[BUG] Standings W-L Issue #179

Closed troyschmid41 closed 1 year ago

troyschmid41 commented 1 year ago

Describe the bug The standings tab doesn't seem to populate the W-L records correctly to each team. It looks like the values are correct but not assigned to the proper manager.

Your League ID 866130738192539648

To Reproduce Steps to reproduce the behavior:

  1. Go to 'League Info/Managers'
  2. Look at W-L records

Expected behavior Correct W-L assigned to proper manager.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

troyschmid41 commented 1 year ago

The power rankings graph and the managers tab also do not seem to align.

nmelhado commented 1 year ago

Do you mind posting some screenshots of the mismatch and your league's website?

troyschmid41 commented 1 year ago

managers standings standingsSleeper

troyschmid41 commented 1 year ago

I also added the managers tab as they don't seem to align with the power rankings order.

lrtoenjes commented 1 year ago

I have this problem too and after some debugging, I believe the rostersStore is not remaining sorted by roster_id. Initially, the "Standings" page is correct, as is the "Managers" page. However, I can reproduce the bug by going to the "Drafts" page and then back to the "Standings" page, and that's when the "Standings" has the manager's incorrectly ordered but the records of W-L correct. I have no Svelte experience, but it seemed me that despite processRosters() in leagueRosters.js sorting the rosters by roster_id, the array did not remain sorted when getLeagueRosters() was called in the leagueDrafts.js file.

nmelhado commented 1 year ago

I have an update coming out (https://github.com/nmelhado/league-page/issues/181) that I believe fixes this just due to revised implementation. I'm hoping to release it within the next week or two.

lrtoenjes commented 1 year ago

@nmelhado I synched the change from #185 into my repo and was still able to reproduce this bug by following the steps in my previous comment. For the time being, I've implemented a small change to the leagueRosters.js utility so that subsequent calls to getLeagueRosters() always returns a sorted rosters array. As stated before, I noticed that the first call to getLeagueRosters() would return a sorted array, but every call after that, would return the unsorted array from the store.

nmelhado commented 1 year ago

Ah ok, I was hoping it was fixed due to how team names are being shown. I'll work on a fix for this. Seems like the sort is a little brittle, so I might just move away from that and turn rosters into an object. Might be slightly more work, but it should prevent similar issues from happening again.

nmelhado commented 1 year ago

@lrtoenjes this should actually fix it. Sorry for the false fix the first time. If there are still issues, let me know!