Sort Considering and Doing by updated_at

This commit is contained in:
Jason Zimdars
2025-04-10 11:06:55 -05:00
parent f3495fa731
commit 1387ad2581
3 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ class CardsController < ApplicationController
PAGE_SIZE = 50
def index
@considering = page_and_filter_for @filter.with(engagement_status: "considering"), per_page: PAGE_SIZE
@doing = page_and_filter_for @filter.with(engagement_status: "doing"), per_page: PAGE_SIZE
@considering = page_and_filter_for @filter.with(engagement_status: "considering", indexed_by: "latest"), per_page: PAGE_SIZE
@doing = page_and_filter_for @filter.with(engagement_status: "doing", indexed_by: "latest"), per_page: PAGE_SIZE
@closed = page_and_filter_for @filter.with(indexed_by: "closed"), per_page: PAGE_SIZE
end
+2
View File
@@ -15,6 +15,7 @@ class Card < ApplicationRecord
scope :reverse_chronologically, -> { order created_at: :desc, id: :desc }
scope :chronologically, -> { order created_at: :asc, id: :asc }
scope :latest, -> { order updated_at: :desc, id: :desc }
scope :in_collection, ->(collection) { where collection: collection }
scope :indexed_by, ->(index) do
@@ -24,6 +25,7 @@ class Card < ApplicationRecord
when "most_boosted" then ordered_by_boosts
when "newest" then reverse_chronologically
when "oldest" then chronologically
when "latest" then latest
when "stalled" then ordered_by_staleness
when "closed" then closed
end
+2 -2
View File
@@ -1,13 +1,13 @@
module Filter::Fields
extend ActiveSupport::Concern
INDEXES = %w[ most_discussed most_boosted newest oldest stalled ]
INDEXES = %w[ most_discussed most_boosted newest oldest latest stalled ]
delegate :default_value?, to: :class
class_methods do
def default_values
{ indexed_by: "most_active" }
{ indexed_by: "latest" }
end
def default_value?(key, value)