Skip to content

Commit

Permalink
[#1879] Fix "negative change" bug by comparing percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
gabemart committed Nov 8, 2015
1 parent f1c3a35 commit 3ec6f98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion akvo/rsr/static/scripts-src/project-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,12 @@ if (firstAccordionChild !== null) {
var changeValueIsNegative;

value = parseInt(value);
value < originalPercentageProgress ? changeValueIsNegative = true : changeValueIsNegative = false;

percentage = (value - minVal) / (maxVal - minVal) * 100;
percentage = percentage > 100 ? 100 : percentage;

percentage < originalPercentageProgress ? changeValueIsNegative = true : changeValueIsNegative = false;

updateMarker.style.left = percentage + '%';
updateMarker.setAttribute('data-value', value);
updateProgress.style.width = percentage + '%';
Expand Down
3 changes: 2 additions & 1 deletion akvo/rsr/static/scripts-src/project-main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,12 @@ if (firstAccordionChild !== null) {
var changeValueIsNegative;

value = parseInt(value);
value < originalPercentageProgress ? changeValueIsNegative = true : changeValueIsNegative = false;

percentage = (value - minVal) / (maxVal - minVal) * 100;
percentage = percentage > 100 ? 100 : percentage;

percentage < originalPercentageProgress ? changeValueIsNegative = true : changeValueIsNegative = false;

updateMarker.style.left = percentage + '%';
updateMarker.setAttribute('data-value', value);
updateProgress.style.width = percentage + '%';
Expand Down

0 comments on commit 3ec6f98

Please sign in to comment.