|
1 | | -import { readCsvFile, seasons, currentSeason, loadSeasonData, mapPosition, calculateAge } from "../components/loadfiles.js"; |
| 1 | +import { readCsvFile, seasons, allSeasons, currentSeason, loadSeasonData, mapPosition, calculateAge } from "../components/loadfiles.js"; |
2 | 2 |
|
3 | 3 | function buildSeasonTeamInfo(sf, teamInfo, teamCash, owners, playerInfo, contracts, currentPicks, nextPicks) { |
4 | 4 | const { rosterPeriods, availablePeriods, lastPeriodNum } = sf; |
@@ -74,8 +74,16 @@ for (const season of seasons) { |
74 | 74 | const owners = await readCsvFile(`${sf.basePath}/owners.csv`); |
75 | 75 | const playerInfo = await readCsvFile(`${sf.basePath}/player_info.csv`); |
76 | 76 | const contracts = await readCsvFile(`${sf.basePath}/contracts.csv`); |
77 | | - const currentPicks = await readCsvFile(`${sf.basePath}/current_picks.csv`); |
78 | | - const nextPicks = await readCsvFile(`${sf.basePath}/next_picks.csv`); |
| 77 | + const currentPicks = await readCsvFile(`${sf.basePath}/draft_picks.csv`); |
| 78 | + const nextSeasonIndex = allSeasons.indexOf(season) + 1; |
| 79 | + let nextPicks = []; |
| 80 | + if (nextSeasonIndex < allSeasons.length) { |
| 81 | + try { |
| 82 | + nextPicks = await readCsvFile(`src/data/static/${allSeasons[nextSeasonIndex]}/draft_picks.csv`); |
| 83 | + } catch (e) { |
| 84 | + nextPicks = []; |
| 85 | + } |
| 86 | + } |
79 | 87 | allData[season] = buildSeasonTeamInfo(sf, teamInfo, teamCash, owners, playerInfo, contracts, currentPicks, nextPicks); |
80 | 88 | } |
81 | 89 |
|
|
0 commit comments