From 99a9543af11c55c3469ce6429bf1f1adad554c58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 07:45:17 +0000 Subject: [PATCH 1/2] Initial plan From 8c54f21829a586351feda6e7b981172cd04f61cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:37:25 +0000 Subject: [PATCH 2/2] Fix popularity sorting to use bookmarks_count column Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- app/services/workshop_search_service.rb | 4 +--- spec/services/workshop_search_service_spec.rb | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/services/workshop_search_service.rb b/app/services/workshop_search_service.rb index 86371c369..d60a0ba73 100644 --- a/app/services/workshop_search_service.rb +++ b/app/services/workshop_search_service.rb @@ -212,9 +212,7 @@ def order_by_params when "led" @workshops = @workshops.order(led_count: :desc, title: :asc) when "popularity" - @workshops = @workshops.order( - Arel.sql("COUNT(bookmarks.id) DESC, workshops.title ASC") - ) + @workshops = @workshops.order(bookmarks_count: :desc, title: :asc) when "title" @workshops = @workshops.order(title: :asc) when "keywords" diff --git a/spec/services/workshop_search_service_spec.rb b/spec/services/workshop_search_service_spec.rb index 471503612..5eaed5260 100644 --- a/spec/services/workshop_search_service_spec.rb +++ b/spec/services/workshop_search_service_spec.rb @@ -65,7 +65,7 @@ context "sorting by bookmarks (popularity)" do it "orders by bookmarks_count desc, then title asc" do - service = WorkshopSearchService.new({ sort: 'bookmarks' }, user: user).call + service = WorkshopSearchService.new({ sort: 'popularity' }, user: user).call workshops = service.workshops expect(workshops.map { |w| [ w.bookmarks_count.to_i, w.title ] }).to eq([