Skip to content

Commit

Permalink
Improve delete old data - keep all ratings/stats from latest season, …
Browse files Browse the repository at this point in the history
…not just latest entry
  • Loading branch information
dumbmatter committed Mar 18, 2024
1 parent 8d4b056 commit 1a145be
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
32 changes: 17 additions & 15 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
new achievements
- Around the World - win title with every franchise (min 30) https://old.reddit.com/r/BasketballGM/comments/1bgxksp/auto_played_almost_9000_seasons_to_get_longevity/kvfh7k9/?context=3
- all active teams, at least 30
- blog about existing leagues and how to trigger it
- Revenge - Beat a team you formerly coached in the finals https://old.reddit.com/r/BasketballGM/comments/1bgxksp/auto_played_almost_9000_seasons_to_get_longevity/kvfh7k9/?context=3
- force challenge mode to remain on
- lose series after being up 3-1 or 3-0
- brick wall 2 https://twitter.com/IcarusGant/status/1632834755241684997
- win title X years after sisyphus mode
- https://old.reddit.com/r/BasketballGM/comments/13472xb/monthly_suggestions_thread/
- Expansion to Champion 3: win the title in the first year of an expansion team
- No Loyalty: Win a championship with no players having spent 5 years on your team
- No Loyalty 2: Win a championship with no players having spent 3 years on your team
- No Loyalty 3: Win a championship with no players having played for your team before
- Ascendance: Win the championship after missing the playoffs
- Ascendance 2: Win the championship after being the worst team in the league

arrow navigation between players on team https://old.reddit.com/r/BasketballGM/comments/1afy7ba/monthly_suggestions_thread/kr9whzi/
- make it a select? or listen for keyboard shortcut?

Expand Down Expand Up @@ -792,21 +809,6 @@ on team history, graph of team ovr / winp / mov over time, star for championship
manually specify draft order in god mode
- make draft page drag-and-drop, with purple handles

new achievements
- win title with every franchise (min 30) https://old.reddit.com/r/BasketballGM/comments/1bgxksp/auto_played_almost_9000_seasons_to_get_longevity/kvfh7k9/?context=3
- Revenge - Beat a team you formerly coached in the finals https://old.reddit.com/r/BasketballGM/comments/1bgxksp/auto_played_almost_9000_seasons_to_get_longevity/kvfh7k9/?context=3
- force challenge mode to remain on
- lose series after being up 3-1 or 3-0
- brick wall 2 https://twitter.com/IcarusGant/status/1632834755241684997
- win title X years after sisyphus mode
- https://old.reddit.com/r/BasketballGM/comments/13472xb/monthly_suggestions_thread/
- Expansion to Champion 3: win the title in the first year of an expansion team
- No Loyalty: Win a championship with no players having spent 5 years on your team
- No Loyalty 2: Win a championship with no players having spent 3 years on your team
- No Loyalty 3: Win a championship with no players having played for your team before
- Ascendance: Win the championship after missing the playoffs
- Ascendance 2: Win the championship after being the worst team in the league

hockey ovr revamp
- ovrs for skater and goalie. determine skater positions like BBGM, including possibility of hybrid positions like F. cause there's really a fair amount of overlap in what players do

Expand Down
10 changes: 8 additions & 2 deletions src/ui/views/DeleteOldData.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState, type FormEvent, type ChangeEvent } from "react";
import useTitleBar from "../hooks/useTitleBar";
import { helpers, logEvent, toWorker } from "../util";
import { ActionButton } from "../components";

const DeleteOldData = () => {
const [state, setState] = useState({
Expand Down Expand Up @@ -151,9 +152,14 @@ const DeleteOldData = () => {
Fame and the completion of in-progress achievements!
</p>

<button className="btn btn-danger" disabled={deleting} type="submit">
<ActionButton
processing={deleting}
processingText="Deleting"
type="submit"
variant="danger"
>
Delete Old Data
</button>
</ActionButton>
</form>
</>
);
Expand Down
9 changes: 7 additions & 2 deletions src/worker/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,16 @@ const deleteOldData = async (options: {
let updated = false;
if (p.ratings.length > 0) {
updated = true;
p.ratings = [p.ratings.at(-1)!];
const latestSeason = p.ratings.at(-1)?.season;
p.ratings = p.ratings.filter(row => row.season >= latestSeason);
}
if (p.stats.length > 0) {
updated = true;
p.stats = [p.stats.at(-1)];
let latestSeason = g.get("season");
if (g.get("phase") === PHASE.PRESEASON) {
latestSeason -= 1;
}
p.stats = p.stats.filter(row => row.season >= latestSeason);
}
if (p.injuries.length > 0) {
if (
Expand Down

0 comments on commit 1a145be

Please sign in to comment.