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

fix bug that affected the draft page of keeper leagues #91

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## [1.2.7] - 2021-10-20

### Fixed

- Bug that affects the draft page of keeper leagues
- Reported in issue [#85](https://github.com/nmelhado/league-page/issues/85)

## [1.2.6] - 2021-10-07

### Added
Expand Down
3 changes: 3 additions & 0 deletions TRAINING_WHEELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ Generate a custom league page for your Sleeper fantasy football league in just a
- In that situation (if you are new to coding), copy the contents of your managers page and your homepage text and delete your repo. Re-follow this guide and re-deploy your page.
- There should be **NO merge conflicts going forward**.

- **WARNING:** There may be merge conflicts in `package-lock.json`. *This should be very rare.*
- Follow these instructions to [resolve the conflict](https://docs.github.com/en/github/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-on-github). For the most part, you'll most likely want to keep the changes from master (the second change)


## V. Wrapping up

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "league-page",
"version": "1.2.6",
"version": "1.2.7",
"homepage": "https://github.com/nmelhado/league-page",
"repository": {
"type": "git",
"url": "git://github.com/nmelhado/league-page.git"
},
"author": {
"name": "Nicholas Melhado",
"email": "[email protected]",
"url": "http://www.nmelhado.com/"
},
"contributors": [
{
"name": "Shane Tjong-Akiet",
"url": "https://github.com/shanetj"
},
{
"name": "Shane Tjong-Akiet",
"url": "https://github.com/shanetj"
Expand Down Expand Up @@ -54,15 +54,15 @@
},
"devDependencies": {
"@sveltejs/adapter-node": "^1.0.0-next.51",
"@sveltejs/adapter-vercel": "next",
"@sveltejs/adapter-vercel": "^1.0.0-next.0",
"@sveltejs/kit": "next",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-svelte3": "^3.2.0",
"eslint-plugin-svelte3": "^3.2.1",
"prettier": "~2.2.1",
"prettier-plugin-svelte": "^2.2.0",
"smui-theme": "^4.2.0",
"svelte": "^3.41.0"
"svelte": "^3.44.0"
},
"type": "module",
"dependencies": {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/utils/helperFunctions/leagueDrafts.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const buildFromScratch = (rosters, previousOrder, rounds, picks, originalManager
}

for(const pick of picks) {
if(pick.owner_id == pick.roster_id) continue;
if(pick.owner_id == pick.roster_id || pick.round > rounds) continue;
draft[pick.round - 1][draftOrder.indexOf(pick.roster_id)] = originalManagers[pick.owner_id].name;
}

Expand Down Expand Up @@ -148,21 +148,21 @@ const buildConfirmed = (draftOrderObj, rounds, picks, originalManagers, players

if(players && type != 'auction') {
// non-auction leagues
draft = completedNonAuction({players, draft, picks, originalManagers, draftOrder});
draft = completedNonAuction({players, draft, picks, originalManagers, draftOrder, rounds});
} else if(players) {
// auction leagues
draft = completedAuction({players, draft, picks, originalManagers, draftOrder, draftOrderObj});
} else {
for(const pick of picks) {
if(pick.owner_id == pick.roster_id) continue;
if(pick.owner_id == pick.roster_id || pick.round > rounds) continue;
draft[pick.round - 1][draftOrder.indexOf(pick.roster_id)] = originalManagers[pick.owner_id].name;
}
}

return {draft, draftOrder};
}

const completedNonAuction = ({players, draft, picks, originalManagers, draftOrder}) => {
const completedNonAuction = ({players, draft, picks, originalManagers, draftOrder, rounds}) => {
for(const playerData of players) {
const player = {
name: `${playerData.metadata.first_name} ${playerData.metadata.last_name}`,
Expand All @@ -173,7 +173,7 @@ const completedNonAuction = ({players, draft, picks, originalManagers, draftOrde
draft[playerData.round - 1][playerData.draft_slot - 1] = {player};
}
for(const pick of picks) {
if(pick.owner_id == pick.roster_id) continue;
if(pick.owner_id == pick.roster_id || pick.round > rounds) continue;
draft[pick.round - 1][draftOrder.indexOf(pick.roster_id)].newOwner = originalManagers[pick.owner_id].name;
}
return draft;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ available for your copy of League Page
*/

// Keep in sync with package.json
export const version = "1.2.6";
export const version = "1.2.7";