New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of better ranges #29

wants to merge 3 commits into
base: dev


None yet
3 participants
Copy link

costamojan commented Oct 30, 2017

  • the artificial creation of ranges in case of an equal min and max has been dropped.
  • the function mergeRanges now merges records first for entries with an equal min and max, so the user doesn't get confronted with weird ranges (previously a record [min=400, max=400] caused a range of 399..401 which is not only weird, it's confusing too as it doesn't resemble the data)
  • the function mergeRanges didn't reduce the number of ranges so if the number of ranges exceeded the $outputLength it still had the same length after going through the original implementation.

Please be aware that I'm not a PHP developer, so there might be better ways to do things. Nevertheless I finally got proper ranges with these changes.

This change is Reviewable

costamojan added some commits Oct 30, 2017

~ fix: dropped the weird range expansion in case min and max are equa…
…l. this was an artificial and non sensical range creation.
~ fix: getting rid of ranges with equal min and max; ~ fix: merging t…
…he ranges now does work (the previous solution didn't work properly as the requirement for a maximum number of ranges had not been fulfilled)

This comment has been minimized.

Copy link

kanecko commented Nov 15, 2017

@costamojan I've tested it a bit and it looks much, much better than the original ranges.
However there is one bug I've found:

  • I have a subcategory with 16 products
  • Their prices are set at 0.90, 1.50, 1.60, 1.80, four products at 2.00, two products at 2.20, two at 2.50, 2.80, 3.80, two at 4.00
  • The ranges generated are 0-1 (4 products) and 2-4 (12 products)
  • The problem is that if I choose the 0-1 range, I will actually get the products with the following prices: 0.90, 1.50, 1.60, 1.80
  • The 2-4 range is working fine

I've only found this bug, if I have a product with a price less than 1.00.
When the range starts at, let's say, 1.00, it works just fine.

What do you suggest I do?


This comment has been minimized.

Copy link

kanecko commented Dec 6, 2017

Upon further testing, it seems that the first range in the list is wrong most of the time.
I've first filtered by some attribute and then I've got two price ranges. I've tried further filtering by the first price range of 3-4 and it's showing a product with price of 4.5.

Other price ranges work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment