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

Unify pretty printing of quantity.Quantity fractions #3129

Merged
merged 3 commits into from
Jul 24, 2020

Conversation

tjanez
Copy link
Member

@tjanez tjanez commented Jul 24, 2020

No description provided.

@tjanez tjanez added the c:staking Category: staking label Jul 24, 2020
@tjanez tjanez force-pushed the tjanez/prettier-unify-frac-comp branch 2 times, most recently from d825fd2 to 6f38b2e Compare July 24, 2020 13:05
Set its base-10 exponent in commissionRateDenominatorExponent and use it
to compute the CommissionRateDenominator.
Make ConvertToTokenAmount() and PrettyPrintCommissionRatePercentage()
use the newly introduced FractionBase10 function.

Add tests for PrettyPrintCommissionRatePercentage() and move it to
go/staking/api/prettyprint.go.
@tjanez tjanez force-pushed the tjanez/prettier-unify-frac-comp branch from 6f38b2e to ae3c937 Compare July 24, 2020 13:08
@codecov
Copy link

codecov bot commented Jul 24, 2020

Codecov Report

Merging #3129 into master will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3129      +/-   ##
==========================================
+ Coverage   68.89%   68.98%   +0.08%     
==========================================
  Files         373      374       +1     
  Lines       36986    36990       +4     
==========================================
+ Hits        25481    25516      +35     
+ Misses       8258     8235      -23     
+ Partials     3247     3239       -8     
Impacted Files Coverage Δ
go/common/prettyprint/quantity.go 100.00% <100.00%> (ø)
go/staking/api/commission.go 95.50% <100.00%> (-0.08%) ⬇️
go/staking/api/prettyprint.go 100.00% <100.00%> (ø)
go/consensus/tendermint/api/api.go 80.64% <0.00%> (-8.61%) ⬇️
go/storage/api/root_cache.go 70.11% <0.00%> (-6.90%) ⬇️
go/common/grpc/policy/policy.go 64.38% <0.00%> (-6.85%) ⬇️
go/storage/metrics.go 81.52% <0.00%> (-6.53%) ⬇️
go/storage/database/database.go 70.58% <0.00%> (-5.05%) ⬇️
go/worker/common/committee/runtime_host.go 65.71% <0.00%> (-4.77%) ⬇️
.../consensus/tendermint/apps/epochtime_mock/state.go 74.46% <0.00%> (-4.26%) ⬇️
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 204b4f7...ae3c937. Read the comment docs.


// FractionBase10 returns a decimal representation of a fraction from fraction's
// numerator and denominator's base-10 exponent.
func FractionBase10(numerator quantity.Quantity, denominatorExp uint8) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

Another idea for the name is QuantityFraction()...

@tjanez tjanez merged commit 02a2481 into master Jul 24, 2020
@tjanez tjanez deleted the tjanez/prettier-unify-frac-comp branch July 24, 2020 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:staking Category: staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants