Skip to content

Commit

Permalink
Sort pos by position number
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmatter committed Oct 12, 2024
1 parent 7b55af3 commit e953192
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
7 changes: 3 additions & 4 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
support sorting mobile trade tables (like saved trades, trading block)
- or have toggle to switch between them?

move from my iterate function to async iterators
- regex search: [\t ]iterate\(

Expand Down Expand Up @@ -226,8 +229,6 @@ more options to set real rookie ratings https://old.reddit.com/r/BasketballGM/co
- rookie season, draft position, peak performance, and career performance - allow weight of each of those for how important it is
- also random (generate a random players draft class and just put the real names on it)

support sorting mobile trade tables (like saved trades, trading block)

new achievements
- moneyball 4 - win 3 championships with hardest constraint https://old.reddit.com/r/BasketballGM/comments/1bgxksp/auto_played_almost_9000_seasons_to_get_longevity/lhgnwm1/?context=3
- force challenge mode to remain on
Expand Down Expand Up @@ -2164,8 +2165,6 @@ live game

---

in table, sort position by constants.POSITIONS order (like roster page in football)

everywhere contract is displayed, make it in italics if not guaranteed
- currently only on roster i think. make a component!

Expand Down
1 change: 1 addition & 0 deletions src/common/getCols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,7 @@ const cols: {
},
Pos: {
desc: "Position",
sortType: "pos",
},
Pot: {
desc: "Potential Rating",
Expand Down
3 changes: 2 additions & 1 deletion src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,8 @@ export type SortType =
| "name"
| "number"
| "record"
| "string";
| "string"
| "pos";

export type Team = {
tid: number;
Expand Down
5 changes: 5 additions & 0 deletions src/ui/components/DataTable/getSortVal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import textContent from "react-addons-text-content";
import type { SortType } from "../../../common/types";
import { helpers } from "../../util";
import { normalizeIntl } from "../../../common/normalizeIntl";
import { POSITIONS } from "../../../common";

const getSortVal = (
value: any = null,
Expand Down Expand Up @@ -135,6 +136,10 @@ const getSortVal = (
return parts.join(", ");
}

if (sortType === "pos") {
return POSITIONS.indexOf(sortVal);
}

if (typeof sortVal === "string") {
return normalizeIntl(sortVal);
}
Expand Down
3 changes: 1 addition & 2 deletions src/ui/views/TradingBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ const TradingBlock = (props: View<"tradingBlock">) => {
pids: props.initialPid !== undefined ? [props.initialPid] : [],
dpids: props.initialDpid !== undefined ? [props.initialDpid] : [],
});
console.log(state);

const handleChangeAsset = (type: "pids" | "dpids", id: number) => {
setState(prevState => {
Expand Down Expand Up @@ -568,7 +567,7 @@ const TradingBlock = (props: View<"tradingBlock">) => {
sumContracts += p.contract.amount;
}
}
console.log(sumContracts);

let footer;
if (sumContracts !== 0) {
footer = [];
Expand Down

0 comments on commit e953192

Please sign in to comment.