Support stalled filtering
This commit is contained in:
@@ -9,9 +9,9 @@ class CardsController < ApplicationController
|
||||
PAGE_SIZE = 50
|
||||
|
||||
def index
|
||||
@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) { |cards| cards.recently_closed_first }
|
||||
@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
|
||||
@closed = page_and_filter_for_closed_cards
|
||||
end
|
||||
|
||||
def create
|
||||
@@ -41,6 +41,14 @@ class CardsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
def page_and_filter_for_closed_cards
|
||||
if @filter.indexed_by.stalled?
|
||||
page_and_filter_for(@filter, per_page: PAGE_SIZE) { |cards| cards.recently_closed_first }
|
||||
else
|
||||
page_and_filter_for(@filter.with(indexed_by: "closed"), per_page: PAGE_SIZE) { |cards| cards.recently_closed_first }
|
||||
end
|
||||
end
|
||||
|
||||
def set_card
|
||||
@card = @collection.cards.find params[:id]
|
||||
end
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ class Card < ApplicationRecord
|
||||
when "newest" then reverse_chronologically
|
||||
when "oldest" then chronologically
|
||||
when "latest" then latest
|
||||
when "stalled" then chronologically
|
||||
when "stalled" then stalled.chronologically
|
||||
when "closed" then closed
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,13 +7,13 @@ module Card::Stallable
|
||||
has_one :activity_spike, class_name: "Card::ActivitySpike", dependent: :destroy
|
||||
|
||||
scope :with_activity_spikes, -> { joins(:activity_spike) }
|
||||
scope :stalled, -> { with_activity_spikes.where(updated_at: ..STALLED_AFTER_LAST_SPIKE_PERIOD.ago) }
|
||||
scope :stalled, -> { open.with_activity_spikes.where("card_activity_spikes.updated_at": ..STALLED_AFTER_LAST_SPIKE_PERIOD.ago) }
|
||||
|
||||
after_update_commit :detect_activity_spikes_later, if: :saved_change_to_last_active_at?
|
||||
end
|
||||
|
||||
def stalled?
|
||||
last_activity_spike_at < STALLED_AFTER_LAST_SPIKE_PERIOD.ago if activity_spike.present?
|
||||
open? && last_activity_spike_at < STALLED_AFTER_LAST_SPIKE_PERIOD.ago if activity_spike.present?
|
||||
end
|
||||
|
||||
def last_activity_spike_at
|
||||
|
||||
@@ -54,7 +54,9 @@ class Command::Ai::Translator
|
||||
* **terms**: Array of keywords (split individually, e.g., ["some", "term"]). Avoid redundancy.
|
||||
* **indexed_by**: "newest", "oldest", "latest", "stalled", "closed".
|
||||
* "closed": completed cards.
|
||||
* "newest": by creation date, "latest": by update date.
|
||||
* "newest": by creation date
|
||||
* "latest": by update date.
|
||||
* "stalled": cards that stopped showing activity after an initial activity spike.
|
||||
* **assignee_ids**: Array of assignee names.
|
||||
* **assignment_status**: "unassigned".
|
||||
* **engagement_status**: "considering" or "doing".
|
||||
|
||||
Reference in New Issue
Block a user