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 NaN% in CLI report #763

Merged
merged 2 commits into from
Oct 11, 2016
Merged

Fix NaN% in CLI report #763

merged 2 commits into from
Oct 11, 2016

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented Oct 11, 2016

fixes #761

Details for reviewers:

  • getTotalWeight was manually turning 0 into 1, to avoid a 0/0 ==> NaN in the computing of overall. It was awkward. I've allowed them to have a value of 0.
  • maxScore is set to 1 initially to allow 0/maxScore to resolve to 0 and not NaN .

}

return weight;
let totalWeight = expectedNames.reduce((last, e) => last + (expected[e].weight || 0), 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion (expected[e].weight || 0)is a bit hard to read. maybe add a comment that you default to 0

Copy link
Contributor

@ebidel ebidel left a comment

Choose a reason for hiding this comment

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

Lgtm

@samccone samccone merged commit a21ec65 into master Oct 11, 2016
@samccone samccone deleted the clireportnan branch October 11, 2016 17:54
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.

DBW: json output contains NaN% and undefined
4 participants