From b48eedcf33d5532c712f426dcd9026bdd961b86b Mon Sep 17 00:00:00 2001 From: Jeremy Scheff Date: Wed, 22 Jan 2025 20:37:49 -0500 Subject: [PATCH] More careful/efficient --- src/worker/api/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/worker/api/index.ts b/src/worker/api/index.ts index a436d3a01..a03184321 100644 --- a/src/worker/api/index.ts +++ b/src/worker/api/index.ts @@ -2001,8 +2001,9 @@ export const augmentOffers = async (offers: TradeTeams[]) => { seasonAttrs: ["won", "lost", "tied", "otl"], season: g.get("season"), addDummySeason: true, - active: true, + active: false, }); + const teamsByTid = groupByUnique(teams, "tid"); const stats = bySport({ baseball: ["gp", "keyStats", "war"], basketball: ["gp", "min", "pts", "trb", "ast", "per"], @@ -2014,7 +2015,7 @@ export const augmentOffers = async (offers: TradeTeams[]) => { return Promise.all( offers.map(async offerRaw => { const tid = offerRaw[1].tid; - const t = teams.find(t => t.tid === tid); + const t = teamsByTid[tid]; if (!t) { throw new Error("No team found"); }