-
Notifications
You must be signed in to change notification settings - Fork 83
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
Show total number of votes and maximum number of votes for all users #488
base: main
Are you sure you want to change the base?
Conversation
!!! Thank you so much for the PR! I'll try to look at it as soon as possible, @kimsey0 ! We can also tweak the documentation/images to get that updated to match your work! As for tests, if you are up for writing some, that'd be great. There should be some basic ones in the repo that you can use as a jumping off point. |
I liked the idea and implementation @kimsey0 🥳 if you can address comments of @mindlessroman, I'd like to merge this PR asap 😄 if you need help with writing tests, etc. please let us know, we can help you out 👍 |
a new exception if the previous one doesn't have a serverError property
Sorry for the long delay here. I've added the skeleton for a test of the vote count display, but I'm having trouble with mocking all the different services the feedback board component uses. Specifically, I can't find any tests that mock the retrospective extension backend, and I don't know how you'd like it structured. I think properly testing this is a bit too big for me. I don't know if one of you would like to take over from the skeleton (I've allowed edits by maintainers), if it can merge as-is (with or without the test changes), or if we should abandon this pull request? |
|
||
jest.mock('../feedbackBoardMetadataForm', () => mocked({})); | ||
jest.mock('azure-devops-extension-api/Work/WorkClient', () => { | ||
const getTeamIterationsMock = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These mocks are copied from feedbackBoardContainer.test.tsx
. I don't know if they're general enough to be moved to the __mocks__
folder. It might also be possible to use a simplified version in these tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this chunk is a copy of the other, I think that's a valid thing to move to __mocks__
folder so there's less duplicate code. It's probably okay to remove any bit that's not explicitly called, but that may be worth doing a local test or two to be sure.
@@ -90,7 +89,7 @@ testColumnsObj[testColumnUuidOne] = { | |||
testColumnsObj[testColumnUuidTwo] = { | |||
columnProperties: | |||
{ | |||
id: TooltipOverflowMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why this was using this random import, but it seemed like a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the diligence! Always appreciated :D
})); | ||
|
||
jest.mock('azure-devops-extension-api/Common', () => ({ | ||
getClient: (clientClass: typeof Object) => new clientClass(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be moved into __mocks__/azure-devops-extension-api/Common/Common.tsx
, but there are some of the other tests that depend on the current behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make a more overarching issue to maybe get the tests and components tidied eventually - may be a bit of an undertaking. For now, you should be good to go!
👏 👏 👏 👏 👏 This is such a good start - I'll try to take a look this weekend! |
@mindlessroman, any news on this? 😄 |
Thank you for the patience here, the 9-5 stuff was occupying a lot of time. Will try to get this looked at as soon as I can. |
@@ -4,6 +4,10 @@ You can find the changelog of the Retrospective Extension below. | |||
|
|||
_PS: Unfortunately, changelog before v1.0.46 is not available_ 🤦♂️ | |||
|
|||
## v1.90.X | |||
|
|||
* Total number of team votes is now shown together with your own vote count. From [GitHub PR #488](https://github.com/microsoft/vsts-extension-retrospectives/pull/488). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -69,7 +69,7 @@ class FeedbackBoard extends React.Component<FeedbackBoardProps, FeedbackBoardSta | |||
defaultActionItemIteration: '', | |||
hasItems: false, | |||
isDataLoaded: false, | |||
currentVoteCount: (props.board.boardVoteCollection === undefined || props.board.boardVoteCollection === null) ? "0" : (props.board.boardVoteCollection[this.props.userId] === undefined || props.board.boardVoteCollection[this.props.userId] === null) ? "0" : props.board.boardVoteCollection[this.props.userId]?.toString() | |||
currentVoteCount: props.board.boardVoteCollection?.[this.props.userId]?.toString() ?? "0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trimming this down!
@@ -90,7 +89,7 @@ testColumnsObj[testColumnUuidOne] = { | |||
testColumnsObj[testColumnUuidTwo] = { | |||
columnProperties: | |||
{ | |||
id: TooltipOverflowMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the diligence! Always appreciated :D
|
||
jest.mock('../feedbackBoardMetadataForm', () => mocked({})); | ||
jest.mock('azure-devops-extension-api/Work/WorkClient', () => { | ||
const getTeamIterationsMock = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this chunk is a copy of the other, I think that's a valid thing to move to __mocks__
folder so there's less duplicate code. It's probably okay to remove any bit that's not explicitly called, but that may be worth doing a local test or two to be sure.
})); | ||
|
||
jest.mock('azure-devops-extension-api/Common', () => ({ | ||
getClient: (clientClass: typeof Object) => new clientClass(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make a more overarching issue to maybe get the tests and components tidied eventually - may be a bit of an undertaking. For now, you should be good to go!
}); | ||
|
||
it(`shows correct vote counts`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it(`shows correct vote counts`, () => { | |
it(`shows correct vote counts when no votes have been cast`, () => { |
optional: a test for when one or two different people have cast their votes? If not, this can have a TODO
or something similar and can be tackled in a later code snippet.
.flatMap((columnId) => this.state.columns[columnId].columnItems); | ||
const participants = new Set(columnItems.flatMap((columnItem) => Object.keys(columnItem.feedbackItem.voteCollection))).size; | ||
|
||
const teamVotes = columnItems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this solution! Great job!
Pull Request
#484
Description
Added total number of votes cast by all participants plus max number of votes that can be cast by all participants to the Vote phase.
I did not update the screenshot in the README, since I can't recreate the user setup.
vsts-extension-retrospectives/README.md
Line 218 in c420655
I calculate these numbers in the render method, since this avoids duplicating logic across
refreshFeedbackItems
andonVoteCasted
. Alternatively, the logic can be split up across these two places, the logic inonVoteCasted
that calculatescurrentVoteCount
could be moved out into the render method, or all of it could be extracted into a new method. Let me know what you prefer.There is currently no tests for
feedbackBoard
, but I'm happy to add some that test this logic. Again, let me know.Lastly, I simplified some lines using the Optional Chaining operator (
?.
) from TypeScript 3.7 and thenull == undefined
equality.Bug or Feature?
Fundamentals
CHANGELOG.md
,to be included with the next release.
Accessibility
Screenshots and Logs
Before
After: