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

[BUG] If you have sleeper playoffs set to OFF the leagueRecords.js calculations are all broken. #283

Open
JimNayzium opened this issue Oct 2, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JimNayzium
Copy link

Describe the bug
With playoffs on sleeper set to NONE the records page gets hung up.

Your League ID
972236561200799744
I think if you use my leagueID you can see what I mean.

To Reproduce
Steps to reproduce the behavior:

  1. Set Sleeper League playoffs to none.
  2. Navigate to Records.
  3. You will get a hung page that gets stuck in the Where loop I think.

Expected behavior
That it would follow logic to skip over the processPlayoffs if hte playoffs are set to none in leagueData.

THANKS for all this code base, it's really great.

@JimNayzium JimNayzium added the bug Something isn't working label Oct 2, 2023
@JimNayzium
Copy link
Author

I think it's related to the winners_bracket and losers_bracket promises never resolving possible? Haven't found it exaclty yet but I think that's a root cause maybe... so curSeason always = curSeason and never equals 0 cuz it never updates to lastYear's value type thing maybe?

@JimNayzium
Copy link
Author

JimNayzium commented Oct 4, 2023

I have tried all day to get this to some how work and I am afraid my novice skills are not good enough to figure it out!
I created a variable hasPlayoffs and set it based on the leageData pulled from sleeper and that all works.

And I submitted that value to processPlayoffs() and run an if/else inside process playoffs and if the hasPlayoffs is false I return:



    playoffRecords.addSeasonWeekRecord({
      year,
      biggestBlowouts: [],
      closestMatchups: [],
      seasonPointsLows: [],
      seasonPointsHighs: []
    });
  }

return playoffRecords;

I tried returning 'null' for each one, and {} for each one and nothing ever keeps me from getting stuck in an endless loop up in this area:


const { season, year } = await processRegularSeason({
	leagueData,
	rosters,
	curSeason,
	week,
        regularSeason,
        svelteFetch
});

//* We need to determine if this league even has playoffs or not before we try and return brackets!
let hasPlayoffs = leagueData.settings.playoff_week_start === 0 ? false : true; // continue if true.

const pS = await processPlayoffs({ hasPlayoffs, year, curSeason, week, playoffRecords, rosters, svelteFetch });
if (pS) {
  playoffRecords = pS; // update the regular season records
}

      //* forward the loop to the nex year here and run it again... 
		lastYear = year;
if (!currentYear && year) {
    currentYear = year;
 }
      
curSeason = season;
}

Where hat last curly-brace is th end of the While(curSeason && curSeason != "0") loop.

Somehow the not processing the playoffs is leaving the curSeason and the year the same forever and I can't for the life of me figure out how to update it ...

THANKS!! AMAzing code base for this novice to work with, but I think I am at my wit's end!

@nmelhado
Copy link
Owner

Hey! Sorry for the delay @JimNayzium. If you can send me where in leagueData that I can see whether a league doesn't have playoffs, I should be able to get this working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants