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] Standings are pulling division record into overall record #276

Closed
sux1536 opened this issue Sep 21, 2023 · 4 comments · Fixed by #297
Closed

[BUG] Standings are pulling division record into overall record #276

sux1536 opened this issue Sep 21, 2023 · 4 comments · Fixed by #297
Assignees
Labels
bug Something isn't working

Comments

@sux1536
Copy link

sux1536 commented Sep 21, 2023

My league uses median scoring and has different divisions. After Week 2, it says the top team is 6-0 (2-0 from H2H, 2-0 from median scoring, but it is also being counted 2-0 from beating a division opponent). I like having the divisions standings as a separate stat, but it should not be included in the overall record which should be 4-0.

On a separate issue, all the season averages are pulling from the 6 games it's saying is played instead of just the 2 weeks that have been played.

I hope all this makes sense, I love your work man~!!

@sux1536 sux1536 added the bug Something isn't working label Sep 21, 2023
@JimNayzium
Copy link

I will second this happening.
What I kind of think is happening as I have been digging deep into it is maybe the median calculation of the league-page was happening PRIOR to Sleeper actually doing this calculation for us.

Because it says I have 6 wins in the json pulled from sleeper not 3 plus 3 median wins.

Then it is adding another median win to the win total pulled from Sleeper possibly?

I am curiuos if we need to shut off the median scoring comparisons inside the league-page modules all together?

Your stuff is fantastic as stated above though! Just trying to do some customizing and noticing this as well.

I have not decided about the divisions yet, but at first glance I don't think mine is pulling the division wins separtely and counting them in the total. But it is counting the overall wins pulled from sleeper which is 6 for 3 weeks as undefeatd but it gives me 9 wins on the standings pages... and stepping through it in the leagueStandings.js I can console.log out these lines and see it happening I think.

` if (medianMatch == true) {
for (let i = 0; i < 2; i++) {
if (matchups[matchupKey][i].points > medianScore) {
let winsNumber = standingsData[matchups[matchupKey][i].rosterID].wins;
standingsData[matchups[matchupKey][i].rosterID].wins++;

      if (matchups[matchupKey][i].rosterID === 1) {
        console.log('\n\n\n============ * Called From * ==========================');
        console.log('\x1b[32mIN: winsNumber in MedianMatch Loop :');
        console.log('    \x1b[34m winsNumber for rosterID: ' + matchups[matchupKey][i].rosterID + '   \x1b[0m= \x1b[35m', winsNumber);
        console.log('\x1b[0m=========================================================\n\n\n');
      }       
    

			} else if (matchups[matchupKey][i].points < medianScore) {
				
      standingsData[matchups[matchupKey][i].rosterID].losses++;
			
    } else if (matchups[matchupKey][i].points == medianScore) {
			
      standingsData[matchups[matchupKey][i].rosterID].ties++;
			
    }
		}
	}`

@JimNayzium
Copy link

And to follow up - I just did this:

const medianMatch = false; //leagueData.settings.league_average_match == 1;

and it made it all accurate, so I think what was happening was Sleeper wasn't allowing us to play vs the median when this oriignal code base was designed and written and he built into the median comparison. Now that sleeper includes that in our wins it doubles those in the outcome of the leagueStandings.js I think.

@sux1536
Copy link
Author

sux1536 commented Oct 2, 2023

I just went in and added the "false; //" and it looks like everything is fixed. Thank you for diving into it!

@JimNayzium
Copy link

Sure thing.
Now we just need to figure out how to fix the leagueRecords.js page when the league does snot have playoffs!
I have a league that does such crazy playoffs I cna't use the sleeper playoffs setting to ON it has to be oFF nad we do the playoffs on paper sort of...

But that ruins the league-page's code for figuring out records and all time matchups and such so far!

@nmelhado nmelhado linked a pull request Apr 28, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants