5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 01:36:22 +00:00

feat: reordenar usando los posts indexados

This commit is contained in:
f 2023-10-06 10:00:50 -03:00
parent 84419c05f8
commit 6946e86a02
No known key found for this signature in database

View file

@ -74,7 +74,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
# { uuid => 2, uuid => 1, uuid => 0 }
def reorder
reorder = params.require(:post).permit(reorder: {})&.dig(:reorder)&.transform_values(&:to_i)
posts = site.posts(lang: locale).where(uuid: reorder.keys)
posts = site.indexed_posts(locale: locale).where(post_id: reorder.keys).map(&:post)
files = posts.map do |post|
next unless post.attribute? :order