20 lines
525 B
Ruby
Raw Normal View History

2024-12-19 15:31:12 -03:00
# frozen_string_literal: true
module DiscourseRewind
class Rewind::Action::BestPosts < Rewind::Action::BaseReport
def call
best_posts =
Post
.where(user_id: user.id)
.where(created_at: date)
.where(deleted_at: nil)
.where("post_number > 1")
.order("like_count DESC NULLS LAST")
2025-01-03 17:25:18 +01:00
.limit(3)
2025-01-06 11:53:18 -06:00
.pluck(:post_number, :topic_id, :like_count, :reply_count, :raw, :cooked)
2024-12-19 15:31:12 -03:00
{ data: best_posts, identifier: "best-posts" }
end
end
end