-
Notifications
You must be signed in to change notification settings - Fork 9
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 the average points for the storypoint results #24
base: fix-styling-etc
Are you sure you want to change the base?
Conversation
@@ -64,6 +64,22 @@ export class StoryPointer extends React.Component { | |||
this.socket.close(); | |||
} | |||
|
|||
calculateAverage(pointers) { |
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 prefer to do things functionally.
const validPointerScore pointer => pointer.score && pointer.score !== '?';
pointers.filter(validPointerScore)
.reduce((total, pointer) => parseInt(total += pointer.score, 10), 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.
That seems a lot less readable though @sedroche
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.
@@ -92,10 +109,13 @@ export class StoryPointer extends React.Component { | |||
let pointers = []; | |||
if (isNewPointerJoined(data)) { | |||
pointers = data.points; | |||
pointers.push({'name': 'Average Points'}); |
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.
Can this be added to the jsx?
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.
With the way that we're rendering the table and it's content, i don't think it's possible to add another row without adding it to this.state.pointers
. We also need to be able to show/clear it.
} | ||
|
||
if (isScoreUpdated(data)) { | ||
pointers = this.createUpdatedStoryPoints(data); | ||
this.calculateAverage(pointers); |
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 we add an average to the jsx this will just become:
this.setState({average: this.calculateAverage(pointers))
Description
Add an average point row in the storypoint table to show the average points of the scores.