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

League leader awards for hockey & football #373

Merged
merged 6 commits into from
Mar 25, 2021

Conversation

domini7
Copy link
Contributor

@domini7 domini7 commented Mar 25, 2021

Hockey

  • Points
  • Goals
  • Assist

Football

  • Passing
  • Rushing
  • Receiving
  • Scrimmage

{
name: "League Passing Leader",
stat: "pssYds",
minValue: 2000,
Copy link
Member

@dumbmatter dumbmatter Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point in a minimum for pure counting stats... it's only needed for per game stats, but none of these are per game. All these minValues should be 0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also why it doesn't work, because the minValue checking code assumes the stats in the player objects are per game, but that's only true in BBGM.

But set it to 0 and it still fails. Why? Because the minValue checking code also assumes "gp" is present, which is not true for hockey and football.

Recommendation - get rid of minValue here, and then just skip the minValue checking code in the leagueLeaders function (the filter inside the loop) if minValue is undefined.

Or let me know if you want me to just take it from here, I'm fine either way :)

Copy link
Member

@dumbmatter dumbmatter Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW this is all happening without any TypeScript error because this part of the codebase is not properly typed (players is any[])

@dumbmatter dumbmatter merged commit 86e48ec into zengm-games:master Mar 25, 2021
@dumbmatter
Copy link
Member

9452e7b slightly different fix than I recommended. Will deploy tomorrow probably, cause I'm about to go to sleep :) thanks!

@domini7 domini7 deleted the league-leaders branch April 1, 2021 17:06
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.

2 participants