Skip to content

Commit ad6f5c2

Browse files
author
Alexandre Stanislawski
committed
fix(price-ranges): makes it uses same operator as the slider
1 parent e15c9b7 commit ad6f5c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

widgets/price-ranges/price-ranges.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ function priceRanges({
8585

8686
refinements.forEach(v => {
8787
if (v.operator.indexOf('>') !== -1) {
88-
from = v.value[0] + 1;
88+
from = Math.floor(v.value[0]);
8989
} else if (v.operator.indexOf('<') !== -1) {
90-
to = v.value[0] - 1;
90+
to = Math.ceil(v.value[0]);
9191
}
9292
});
9393
return [{from, to, isRefined: true}];
@@ -99,10 +99,10 @@ function priceRanges({
9999
helper.clearRefinements(attributeName);
100100
if (facetValues.length === 0 || facetValues[0].from !== from || facetValues[0].to !== to) {
101101
if (typeof from !== 'undefined') {
102-
helper.addNumericRefinement(attributeName, '>', from - 1);
102+
helper.addNumericRefinement(attributeName, '>=', Math.floor(from));
103103
}
104104
if (typeof to !== 'undefined') {
105-
helper.addNumericRefinement(attributeName, '<', to + 1);
105+
helper.addNumericRefinement(attributeName, '<=', Math.ceil(to));
106106
}
107107
}
108108

0 commit comments

Comments
 (0)