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 Draftmancer pick breakdown #2606

Conversation

KaelenProctor
Copy link
Contributor

@KaelenProctor KaelenProctor commented Feb 11, 2025

Problems

  1. Clicking on picks from packs > 1 on the left nav still shows the contents of the first pack
  2. The pack/pick numbers were not accurate

Testing

I tested a Draftmancer draft locally in two ways:

  1. Exported from the reactProps the Draftmancer state from https://cubecobra.com/cube/deck/35d3237d-23dc-470c-9035-abd19f7a6cc2?view=picks&seat=1 (original bug report) and forced by local to use that in the reactProps. Had to use against a cube with an equivalent number of cards
  2. Imported a Draftmancer draft into the api/draftmancer/publish endpoint. "Wacky" draft example provided by Dekkaru

Before

As you click through the picks once you get to pack 2 you see the same cards as in pack 1 and the same pick #. Also you can see the pack/pick numbers are all over the place.
old-draftmancer-draft-picks-recycles-first-pack

After

Now each pack shows the correct cards
new-draftmancer-draft-picks-through-packs

And the pick/pack number are accurate
new-draftmancer-draft-picks-wacky-draft-correct-pack_pick-numbers

the first.

Add the count of picks of the previous packs to the current index from
the draftmancer log, instead of InitialState which is for CubeCobra
drafts.
@@ -142,7 +146,7 @@ const DraftmancerBreakdown: React.FC<BreakdownProps> = ({ draft, seatNumber, pic
</Flexbox>
</Col>
<Col xs={6} sm={8} lg={9} xl={10}>
<Text semibold lg>{`Pack ${(pack || 0) + 1}: Pick ${pick}`}</Text>
<Text semibold lg>{`Pack ${pack || 0}: Pick ${pick}`}</Text>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DraftMancer drafts, unlike CubeCobra drafts, have to break the picks into packs ourselves and the code starts that at 1. CubeCobra packs are arrays starting from zero.

if (draft.InitialState !== undefined) {
picks += draft.InitialState[0][i].cards.length;
}
picks += picksList[i].length;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sum the picks of the packs before this one. That plus the index within this pack is the overall card index

}
}

if (i === parseInt(pickNumber)) {
cardsInPack = log[i].booster;
pick = log[i].pick;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log[i].pick is the card index of the overall set of cards, as best I can see

@dekkerglen dekkerglen merged commit 272d385 into dekkerglen:master Feb 12, 2025
1 check passed
@KaelenProctor KaelenProctor deleted the feature/fix-draftmancer-pick-breakdown branch February 12, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants