Repository navigation
fix(game-states): resolve targetCard jack ownership when parsing multiple jacks (#1210) - #1446
Open
rajpreetcodes wants to merge 1 commit into
Open
rajpreetcodes wants to merge 1 commit into
rajpreetcodes wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number
Relevant issue number
gamestaterow.targetCardincorrectly parses ownership of the first jack when there are an even number of jacks #1210Please check the following
Please describe additional details for testing this change
Root Cause
When packing
gameState.targetCardorgameState.oneOffTargetinto aGameStateRow,packGamestateconverted the card object without specifying the player who controlled the target card prior to the move. InconcatAttachtToId, when an even number of jacks was attached,cardOwnerwas evaluated asundefined, leading to serialized strings likeTS(JD-undefined,JH-p0)instead ofTS(JD-p1,JH-p0).Changes
api/helpers/game-states/pack-gamestate.js:targetOwneras the opponent ofgameState.playedBy(gameState.playedBy === 0 ? 'p1' : 'p0') when packingtargetCardoroneOffTarget.targetOwnertoconvertCardToStr(value, targetOwner)so attachments on targeted cards know which player was targeted.api/helpers/game-states/convert-card-to-str.js:concatAttachtToIdsocardOwnerdefaults safely to'p0'.playerNumis guaranteed to resolve to'p0'or'p1', preventing any possibility of-undefinedappearing in card string outputs.tests/unit/specs/sails/game-state.spec.js:targetCardwith even (2) jacks, odd (1) jack, and omittedcardOwnersafety.Validation
npm run lint: 0 errorsnpm run test:unit: All 108 tests passing (100 sails + 8 client)npm run build: built cleanly in production