-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
[Progress] Fix wrong error on validating sum total on multiple progress #758
[Progress] Fix wrong error on validating sum total on multiple progress #758
Conversation
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.
Why don't we just use 10 as a default value for precision?
Alright, my suggestion of using 10 as always default precision could lead into never reaching 100% at all.. So your approach is of course better 🙂 |
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.
LGTM
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.
LGTM
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.
Sorry, but there is something wrong when the precision is set to 1. Calculation seems right, but bar color/width is messed up
https://jsfiddle.net/kmbc7fog/3/
In addition, the docs say the precision default setting is 1, although it's 0 in the code (which is correct)
This is not related to your changes, i just recognized it and we should setup an additional docs-PR to fix this and also add more information there like "0 means calculated precision, 1 means 1 decimal point , 10 means 2 decimal points, 100 means 3 decimal points, and so on)
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.
Using precision:10
breaks it again as before (calculates a value > 100%)
https://jsfiddle.net/kmbc7fog/4/
-> What about comparing against the sum of values instead of the sum of percentages ?
You may join forces with @ryamaguchi0220 .
The following jsfiddle contains a combo of your PR and the changes from #759, because it works then
https://jsfiddle.net/kmbc7fog/6/
All green ars are due to I took changes from #759 into this PR. |
…recision # Conflicts: # src/definitions/modules/progress.js
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.
All green ars are due to
autoSuccess: true (default)
.
IfautoSuccess: false
, bars show each own color even when 100% reached.
As autoSuccess
has true
by default and IMHO that feature does not make sense when working with multiple progressbars i suggest to ignore that setting:
if(settings.autoSuccess && !(module.is.warning() || module.is.error() || module.is.success())) { |
should be changed to
if(settings.autoSuccess && $bars.length === 1 && !(module.is.warning() || module.is.error() || module.is.success())) {
Works as expected then: https://jsfiddle.net/kmbc7fog/7/
@exoego In case you missed my comment for "autoSuccess" , here is a kind reminder... Would like to get this PR approved for the next release 😉 |
…ltiple progress bars
Oops. |
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.
LGTM
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.
LGTM
Oops. The casehttps://jsfiddle.net/La8twh3u/ Screen shots |
True. |
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.
LGTM
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.
LGTM
Docs corrected by fomantic/Fomantic-UI-Docs#134 |
Description
Validation on sum of percents now is performed before rounding, as proposed by @ryamaguchi0220 in [Progress] Fix to validate the sum of the percents before rounding #759.
Add
module.helper.derivePrecision
that calculates small-enough precision for multiple progress.This is handy for users since they do not need to take care about precision for most cases.
If
precision
option is explicitly specified, it is used.Testcase
https://jsfiddle.net/x1ptzvs7/
Screenshot (when possible)
Multiple progress bars are shown for the data in #757
![image](https://user-images.githubusercontent.com/127635/58075696-5081fe80-7be3-11e9-8179-90b9a21b8332.png)
Closes
#757