Skip to content

Commit

Permalink
fix(price-ranges): makes it uses same operator as the slider
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Stanislawski committed Nov 5, 2015
1 parent e15c9b7 commit ad6f5c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions widgets/price-ranges/price-ranges.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function priceRanges({

refinements.forEach(v => {
if (v.operator.indexOf('>') !== -1) {
from = v.value[0] + 1;
from = Math.floor(v.value[0]);
} else if (v.operator.indexOf('<') !== -1) {
to = v.value[0] - 1;
to = Math.ceil(v.value[0]);
}
});
return [{from, to, isRefined: true}];
Expand All @@ -99,10 +99,10 @@ function priceRanges({
helper.clearRefinements(attributeName);
if (facetValues.length === 0 || facetValues[0].from !== from || facetValues[0].to !== to) {
if (typeof from !== 'undefined') {
helper.addNumericRefinement(attributeName, '>', from - 1);
helper.addNumericRefinement(attributeName, '>=', Math.floor(from));
}
if (typeof to !== 'undefined') {
helper.addNumericRefinement(attributeName, '<', to + 1);
helper.addNumericRefinement(attributeName, '<=', Math.ceil(to));
}
}

Expand Down

0 comments on commit ad6f5c2

Please sign in to comment.