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

Trade filter #358

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
13 changes: 13 additions & 0 deletions public/css/dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ $text-muted: $gray-400;
color: $primary;
}

.check-item-default {
color: $gray-600;
background: $gray-200;
}
.check-item-checked {
background: $primary;
color: $black;
border-color: $primary;
}
.color-primary {
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 the same as the text-primary class built into Bootstrap.

Possibly those other classes could be replaced by something in Bootstrap too, not sure...

color: $primary;
}

.text-danger {
color: lighten($red, 10) !important;
}
Expand Down
13 changes: 12 additions & 1 deletion public/css/light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,18 @@ tr.table-warning:hover > td {
border: 1px solid $blue !important;
color: $gray-700 !important;
}

.color-primary {
color: $primary;
}
.check-item-default {
color: $gray-600;
background: $gray-200;
}
.check-item-checked {
background: $primary;
color: $white;
border-color: $primary;
}
.navbar-border {
border-bottom: 1px solid $gray-200;
}
Expand Down
53 changes: 44 additions & 9 deletions src/common/constants.basketball.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
import type { CompositeWeights, Conf, Div } from "./types";
import type { CompositeWeights, Conf, Div, Skill } from "./types";
import type { RatingKey } from "./types.basketball";

const SKILLS: Skill = {
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to instead add a "description" field to COMPOSITE_WEIGHTS? Then there's never any concern that SKILLS and COMPOSITE_WEIGHTS could fall out of sync.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah I'll change it to that approach. We'll just have to call a mapping function to extract the skill labels/descriptions (iirc) when we want them. Couldn't decide which way to go with it between the two

B: {
label: "B",
description: "Ball Handler",
},
Ps: {
label: "Ps",
description: "Passer",
},
Po: {
label: "Po",
description: "Post Scorer",
},
"3": {
label: "3",
description: "Three Point Shooter",
},
R: {
label: "R",
description: "Rebounder",
},
Di: {
label: "Di",
description: "Interior Defender",
},
Dp: {
label: "Dp",
description: "Perimeter Defender",
},
A: {
label: "A",
description: "Athlete",
},
};
const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
Copy link
Member

Choose a reason for hiding this comment

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

Very recently a "V" "Volume scorer" label was added to "scoring", looks like it got lost in a merge.

Copy link
Author

Choose a reason for hiding this comment

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

I also just realized I seem to have caught you guys as hockey is being added. I'll go ahead and make sure those are included as well

pace: {
ratings: ["spd", "jmp", "dnk", "tp", "drb", "pss"],
Expand All @@ -17,15 +51,15 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["drb", "spd"],
weights: [1, 1],
skill: {
label: "B",
label: SKILLS.B.label,
cutoff: 0.68,
},
},
passing: {
ratings: ["drb", "pss", "oiq"],
weights: [0.4, 1, 0.5],
skill: {
label: "Ps",
label: SKILLS.Ps.label,
cutoff: 0.63,
},
},
Expand All @@ -41,7 +75,7 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["hgt", "stre", "spd", "ins", "oiq"],
weights: [1, 0.6, 0.2, 1, 0.4],
skill: {
label: "Po",
label: SKILLS.Po.label,
cutoff: 0.61,
},
},
Expand All @@ -53,7 +87,7 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["oiq", "tp"],
weights: [0.1, 1],
skill: {
label: "3",
label: SKILLS["3"].label,
cutoff: 0.59,
},
},
Expand All @@ -64,7 +98,7 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["hgt", "stre", "jmp", "reb", "oiq", "diq"],
weights: [2, 0.1, 0.1, 2, 0.5, 0.5],
skill: {
label: "R",
label: SKILLS.R.label,
cutoff: 0.61,
},
},
Expand Down Expand Up @@ -92,15 +126,15 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["hgt", "stre", "spd", "jmp", "diq"],
weights: [2.5, 1, 0.5, 0.5, 2],
skill: {
label: "Di",
label: SKILLS.Di.label,
cutoff: 0.57,
},
},
defensePerimeter: {
ratings: ["hgt", "stre", "spd", "jmp", "diq"],
weights: [0.5, 0.5, 2, 0.5, 1],
skill: {
label: "Dp",
label: SKILLS.Dp.label,
cutoff: 0.61,
},
},
Expand All @@ -112,7 +146,7 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["stre", "spd", "jmp", "hgt"],
weights: [1, 1, 1, 0.75],
skill: {
label: "A",
label: SKILLS.A.label,
cutoff: 0.63,
},
},
Expand Down Expand Up @@ -496,6 +530,7 @@ const DEFAULT_DIVS: Div[] = [
const DEFAULT_STADIUM_CAPACITY = 25000;

export {
SKILLS,
AWARD_NAMES,
DEFAULT_CONFS,
DEFAULT_DIVS,
Expand Down
71 changes: 59 additions & 12 deletions src/common/constants.football.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,93 @@
import type { CompositeWeights, Conf, Div } from "./types";
import type { CompositeWeights, Conf, Div, Skill } from "./types";
import type { Position, PrimaryPosition, RatingKey } from "./types.football";

const SKILLS: Skill = {
Pa: {
label: "Pa",
description: "Accurate Passer",
},
Pd: {
label: "Pd",
description: "Deep Passer",
},
Ps: {
label: "Ps",
description: "Smart Passer",
},
A: {
label: "A",
description: "Athletic",
},
X: {
label: "X",
description: "Explosive Runner",
},
H: {
label: "H",
description: "Hands",
},
Bp: {
label: "Bp",
description: "Pass Blocker",
},
Br: {
label: "Br",
description: "Run Blocker",
},
PR: {
label: "PR",
description: "Pass Rusher",
},
RS: {
label: "RS",
description: "Run Stopper",
},
L: {
label: "L",
description: "Lockdown Coverage",
},
};
const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
passingAccuracy: {
ratings: ["tha", "hgt"],
weights: [1, 0.2],
skill: {
label: "Pa",
label: SKILLS.Pa.label,
},
},
passingDeep: {
ratings: ["thp", "tha", "hgt"],
weights: [1, 0.1, 0.2],
skill: {
label: "Pd",
label: SKILLS.Pd.label,
},
},
passingVision: {
ratings: ["thv", "hgt"],
weights: [1, 0.5],
skill: {
label: "Ps",
label: SKILLS.Ps.label,
},
},
athleticism: {
ratings: ["stre", "spd", "hgt"],
weights: [1, 1, 0.2],
skill: {
label: "A",
label: SKILLS.A.label,
},
},
rushing: {
ratings: ["stre", "spd", "elu"],
weights: [0.5, 1, 1],
skill: {
label: "X",
label: SKILLS.X.label,
},
},
catching: {
ratings: ["hgt", "hnd"],
weights: [0.2, 1],
skill: {
label: "H",
label: SKILLS.H.label,
},
},
gettingOpen: {
Expand All @@ -52,35 +98,35 @@ const COMPOSITE_WEIGHTS: CompositeWeights<RatingKey> = {
ratings: ["hgt", "stre", "spd", "pbk"],
weights: [0.5, 1, 0.2, 1],
skill: {
label: "Bp",
label: SKILLS.Bp.label,
},
},
runBlocking: {
ratings: ["hgt", "stre", "spd", "rbk"],
weights: [0.5, 1, 0.4, 1],
skill: {
label: "Br",
label: SKILLS.Br.label,
},
},
passRushing: {
ratings: ["hgt", "stre", "spd", "prs", "tck"],
weights: [1, 1, 0.5, 1, 0.25],
skill: {
label: "PR",
label: SKILLS.PR.label,
},
},
runStopping: {
ratings: ["hgt", "stre", "spd", "rns", "tck"],
weights: [0.5, 1, 0.5, 1, 1],
skill: {
label: "RS",
label: SKILLS.RS.label,
},
},
passCoverage: {
ratings: ["hgt", "spd", "pcv", "tck"],
weights: [0.1, 1, 1, 0.25],
skill: {
label: "L",
label: SKILLS.L.label,
},
},
tackling: {
Expand Down Expand Up @@ -485,6 +531,7 @@ const DEFAULT_DIVS: Div[] = [
const DEFAULT_STADIUM_CAPACITY = 70000;

export {
SKILLS,
AWARD_NAMES,
DEFAULT_CONFS,
DEFAULT_DIVS,
Copy link
Member

Choose a reason for hiding this comment

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

In addition to constants.basketball.ts and constants.football.ts, there's now also constants.hockey.ts :)

Exciting times...

Expand Down
14 changes: 13 additions & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import * as constantsBasketball from "./constants.basketball";
import * as constantsFootball from "./constants.football";
import * as constantsHockey from "./constants.hockey";

import type { CompositeWeights, Phase, DraftType, MoodTrait } from "./types";
import type {
CompositeWeights,
Phase,
DraftType,
MoodTrait,
Skill,
} from "./types";

const ACCOUNT_API_URL =
process.env.NODE_ENV === "development"
Expand Down Expand Up @@ -142,6 +148,11 @@ const POSITIONS = bySport<any[]>({
hockey: constantsHockey.POSITIONS,
});

const SKILLS: Skill =
process.env.SPORT === "football"
? constantsFootball.SKILLS
: constantsBasketball.SKILLS;

const TEAM_STATS_TABLES: {
[key: string]: {
name: string;
Expand Down Expand Up @@ -285,5 +296,6 @@ export {
SUBREDDIT_NAME,
TEAM_STATS_TABLES,
TIME_BETWEEN_GAMES,
SKILLS,
TWITTER_HANDLE,
};
4 changes: 4 additions & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export type Conditions = {
hostID?: number;
};

export type Skill = {
[key: string]: { description: string | undefined; label: string };
};

export type DraftLotteryResultArray = {
tid: number;
originalTid: number;
Expand Down
Loading