[openstreetmap/openstreetmap-website] Sort and order notes (#2381)
rugk
notifications at github.com
Sun Dec 15 12:59:30 UTC 2019
rugk commented on this pull request.
> - @notes = @notes.order("updated_at DESC").limit(result_limit).preload(:comments)
+ @notes = if params[:sort] == "created_at"
+ if params[:order] == "oldest"
+ @notes.order("created_at ASC")
+ else
+ @notes.order("created_at DESC")
+ end
+ else
+ if params[:order] == "oldest"
+ @notes.order("updated_at ASC")
+ else
+ @notes.order("updated_at DESC")
+ end
+ end
+
+ @notes = @notes.distinct.limit(result_limit).preload(:comments)
This does fix a big problem with duplicate notes, see https://github.com/ENT8R/NotesReview/issues/43
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2381#discussion_r357977147
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20191215/fd598266/attachment.html>
More information about the rails-dev
mailing list