| @@ -28,11 +28,15 @@ | ||
| 28 | 28 | // Get price range from TripRepository |
| 29 | 29 | $tripRepository = new \Yatra\Repositories\TripRepository(); |
| 30 | 30 | $price_stats = $tripRepository->getPriceRangeStats(); |
| 31 | 31 | |
| 32 | - $min_price = $options['min_price'] ?? ($price_stats->min_price ?? 100); | |
| 33 | - $max_price = $options['max_price'] ?? ($price_stats->max_price ?? 5000); | |
| 34 | - $step = $options['step'] ?? max(1, ($max_price - $min_price) / 100); | |
| 32 | + $min_price = (int) floor((float) ($options['min_price'] ?? ($price_stats->min_price ?? 100))); | |
| 33 | + $max_price = (int) ceil((float) ($options['max_price'] ?? ($price_stats->max_price ?? 5000))); | |
| 34 | + // Step 1 so the range slider can reach the true max exactly. A coarser | |
| 35 | + // step only lets the thumb stop on min + N*step, capping the slider | |
| 36 | + // short of the real maximum when (max - min) isn't a whole multiple of | |
| 37 | + // that step (e.g. min 9 / max 10000 / step 100 stops at 9909). | |
| 38 | + $step = $options['step'] ?? 1; | |
| 35 | 39 | |
| 36 | 40 | ob_start(); |
| 37 | 41 | ?> |
| 38 | 42 | <div class="yatra-filter-section"> |