Fix surplus math for players projected below $3M - #8
Open
cschmertz wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now any projection under $3.0M comes back as the string "Minimum Salary", and every spot that computes surplus turns that into $0. That makes fairly paid minimum players look like bad contracts. Russell Westbrook, paid the $2.3M vet minimum, shows -2.3M surplus. A player projected at $2.9M on a $2.3M deal shows -2.3M too, when he's really a small bargain. The same thing happens in every row of the multi-year table, so Total Contract Surplus gets dragged down for basically every cheap veteran on the list.
The fix: calculateSalary now always returns a number, floored at a new MIN_SALARY constant (2.3, the approximate vet minimum cap hit in 2025-26 dollars, which matches what most of the min guys in players.js are actually paid). The "Min" label still shows for anything under $3M, it just happens at display time instead of inside the math. In the future years table the floored value gets inflated by the same scalers as everything else, so a min player on a future min deal nets out to roughly zero surplus like you'd expect.
I also switched the surplus color check from "greater than 0" to "0 or more", since exactly-zero surpluses are common now and a fair min contract shouldn't render red.
Before and after with the default sliders (70 games, 30 minutes):
Nothing changes for any player whose projection is above $3M. Tested in the browser.