Skip to content

Conversation

@RohanNagar
Copy link
Contributor

Closes #120.

@RohanNagar RohanNagar changed the title Zero percent Change PR body when file size reduced by zero percent Jul 31, 2018
@dlemstra
Copy link
Contributor

Wonder if it wouldn't be nicer to print 0.3% when the rounded value is zero and otherwise print a rounded percentage e.g 1%?

sb.AppendLine();
sb.AppendLine($"Your image file size has been reduced by **{imageStats[0].Percent:N0}%** 🎉");

if (Math.Round(imageStats[0].Percent) == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}

[TestMethod]
public void GivenZeroPercentReductionCommitMessage_ShouldOmitPercentage()
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@dabutvin
Copy link
Contributor

@RohanNagar this looks great!

@dlemstra I agree that we could add that kind of logic. Hadn't thought about it when I wrote up the issue. I'll file a new request to make the change. This PR gives us the hook we need to build on. We had some other issues logged a while back about converting from KB to MB in some cases too

@dabutvin dabutvin merged commit e97e51c into imgbot:master Jul 31, 2018
@RohanNagar RohanNagar deleted the zero-percent branch April 23, 2021 17:05
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