Skip to content

Commit

Permalink
Fix results qty accuracy for slider-based filters
Browse files Browse the repository at this point in the history
Range-slider has a bug with expected results counter. This leads to displaying wrong quantity of expected results. For example when I have filtered an attribute to values between 70 and 80 (my_attribute=70-80) this method will return 70-79.9999... instead of 70-80. This contribution will will fix accuracy.
  • Loading branch information
mborkowski authored and Aurélien FOUCRET committed Feb 23, 2018
1 parent c37461e commit 90074ce
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ define(["jquery", 'Magento_Catalog/js/price-utils', 'mage/template', "jquery/ui"

_getItemCount : function() {
var from = this.from, to = this.to, intervals = this.intervals;
var count = intervals.map(function(item) {return item.value >= from && item.value < to ? item.count : 0;})
var count = intervals.map(function(item) {return item.value >= from && item.value <= to ? item.count : 0;})
.reduce(function(a,b) {return a + b;});
return count;
},
Expand Down

0 comments on commit 90074ce

Please sign in to comment.