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

Show the average points for the storypoint results #24

Open
wants to merge 2 commits into
base: fix-styling-etc
Choose a base branch
from

Conversation

JameelB
Copy link
Collaborator

@JameelB JameelB commented Jul 23, 2018

Description

Add an average point row in the storypoint table to show the average points of the scores.

@JameelB JameelB requested a review from sedroche July 23, 2018 09:06
@@ -64,6 +64,22 @@ export class StoryPointer extends React.Component {
this.socket.close();
}

calculateAverage(pointers) {
Copy link
Collaborator

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)

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dimitraz I would say the opposite :)

@JameelB It's up to you, either way is fine with me.

@@ -92,10 +109,13 @@ export class StoryPointer extends React.Component {
let pointers = [];
if (isNewPointerJoined(data)) {
pointers = data.points;
pointers.push({'name': 'Average Points'});
Copy link
Collaborator

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?

Copy link
Collaborator Author

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);
Copy link
Collaborator

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))

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.

3 participants