Skip to content

Fix surplus math for players projected below $3M - #8

Open
cschmertz wants to merge 1 commit into
StephenNoh:mainfrom
cschmertz:fix-min-salary-surplus
Open

Fix surplus math for players projected below $3M#8
cschmertz wants to merge 1 commit into
StephenNoh:mainfrom
cschmertz:fix-min-salary-surplus

Conversation

@cschmertz

Copy link
Copy Markdown

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):

  • Westbrook: was -2.3M surplus, now 0.0M
  • Jokic: $68.2M projected value and +13.0M surplus, identical to before

Nothing changes for any player whose projection is above $3M. Tested in the browser.

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

Successfully merging this pull request may close these issues.

1 participant