Skip to content

Stats distribution on Football GM fixed#306

Merged
dumbmatter merged 2 commits into
zengm-games:masterfrom
luso97:stats_distribution_football
Sep 3, 2020
Merged

Stats distribution on Football GM fixed#306
dumbmatter merged 2 commits into
zengm-games:masterfrom
luso97:stats_distribution_football

Conversation

@luso97
Copy link
Copy Markdown
Contributor

@luso97 luso97 commented Sep 1, 2020

Ok, so I fixed this by adding a menu item to the stats distribution when in Football GM. The only problem I found is that in some stats in Football GM like defInt the median, first and second quartile are 0 so the boxplot is not really informative. I used the same filter that you use for deciding which players has a table for each category (with the PLAYER_STATS_TABLE). I don´t know if this will be commited but it was fun anyway to fix it.
teamsStatsFGM

-Added menus to the stats distribution in Football-GM

-Added menus to the stats distribution in Football-GM
@luso97 luso97 changed the title Error corrected Stats distribution on Football GM fixed Sep 1, 2020
Comment thread src/worker/views/teamStatDists.ts Outdated
import { idb } from "../db";
import { g, helpers } from "../util";
import type { UpdateEvents, ViewInput } from "../../common/types";
import { TEAM_STATS_DIST_TABLE } from "../../common";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this is the only place importing it, and that probably will not change, you should just inline this below rather than put it in common.

Even better might be to make this use TEAM_STATS_TABLES with a dropdown to select the table, just like you did in PlayerStatDists. But don't feel obligated to do that... even with just a table of team stats, it's better than nothing!

Comment thread src/worker/views/playerStatDists.ts Outdated
"pts",
"per",
];
console.log(inputs);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove console.log

Comment thread src/worker/views/playerStatDists.ts Outdated
];
console.log(inputs);
const stats =
process.env.SPORT === "basketball"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same thing could be done for basketball, using PLAYER_STATS_TABLES and a dropdown... but like I said in my other comment, consider that optional, cause this PR is an improvement even without that!

});
if (process.env.SPORT == "football") {
const statTable = PLAYER_STATS_TABLES[inputs.statType];
const onlyShowIf = statTable.onlyShowIf as string[];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is casting to string[] really needed here?

@dumbmatter
Copy link
Copy Markdown
Member

This is cool! Left a few small comments, but I definitely want to merge this.

I think when doing the original football port I ran into the same issue, where it's less clear which players to include in the distribution for football than for basketball... and then I guess I just forgot about it lol

Still work in progress since maybe it would be neccesary to add the stats from 2018-20 to this stats too
@dumbmatter dumbmatter merged commit cee923a into zengm-games:master Sep 3, 2020
@dumbmatter
Copy link
Copy Markdown
Member

Thanks! I added a couple more commits to hide non-numeric stats (like qbRec) and to use nice text for the variable names (like table headers in stats tables).

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