Skip to content

Commit

Permalink
Shorten position math
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Nov 17, 2023
1 parent 9785544 commit d12faed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Commands/IndexProductsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function handle()
$data['positions'] = $product->categoryProducts
->pluck('position', 'category_id')
// Turn all positions positive
->mapWithKeys(fn ($position, $category_id) => [$category_id => (($position * -1) + $maxPositions[$category_id])]);
->mapWithKeys(fn ($position, $category_id) => [$category_id => $maxPositions[$category_id] - $position]);

return Eventy::filter('index.product.data', $data, $product);
});
Expand Down

0 comments on commit d12faed

Please sign in to comment.