Browse Source

Reverse ternary to allow falsey values to evaluate as no precision

pull/2300/head
jlukic 9 years ago
parent
commit
525a61dff9
1 changed files with 9 additions and 9 deletions
  1. 18
      src/definitions/modules/progress.js

18
src/definitions/modules/progress.js

@ -233,9 +233,9 @@ $.fn.progress = function(parameters) {
? (barWidth / totalWidth * 100)
: module.percent
;
return (settings.precision === 0)
? Math.round(displayPercent)
: Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
return (settings.precision > 0)
? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
: Math.round(displayPercent)
;
},
@ -357,15 +357,15 @@ $.fn.progress = function(parameters) {
percent = percent * 100;
}
// round percentage
percent = (settings.precision === 0)
? Math.round(percent)
: Math.round(percent * (10 * settings.precision)) / (10 * settings.precision)
percent = (settings.precision > 0)
? Math.round(percent * (10 * settings.precision)) / (10 * settings.precision)
: Math.round(percent)
;
module.percent = percent;
if(module.total) {
module.value = (settings.precision === 0)
? Math.round( (percent / 100) * module.total * 10) / 10
: Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision)
module.value = (settings.precision > 0)
? Math.round( (percent / 100) * module.total * (10 * settings.precision)) / (10 * settings.precision)
: Math.round( (percent / 100) * module.total * 10) / 10
;
}
else if(settings.limitValues) {

Loading…
Cancel
Save