Fix: queries were failing due to using the wrong alias
This commit is contained in:
@@ -5,8 +5,8 @@ module Card::Engageable
|
||||
has_one :engagement, dependent: :destroy, class_name: "Card::Engagement"
|
||||
|
||||
scope :considering, -> { published_or_drafted_by(Current.user).open.where.missing(:engagement) }
|
||||
scope :on_deck, -> { published.open.joins(:engagement).where(card_engagements: { status: "on_deck" }) }
|
||||
scope :doing, -> { published.open.joins(:engagement).where(card_engagements: { status: "doing" }) }
|
||||
scope :on_deck, -> { published.open.joins(:engagement).where(engagement: { status: "on_deck" }) }
|
||||
scope :doing, -> { published.open.joins(:engagement).where(engagement: { status: "doing" }) }
|
||||
|
||||
scope :by_engagement_status, ->(status) do
|
||||
case status.to_s
|
||||
|
||||
@@ -18,7 +18,9 @@ class Filter < ApplicationRecord
|
||||
|
||||
def cards
|
||||
@cards ||= begin
|
||||
result = creator.accessible_cards.indexed_by(indexed_by).sorted_by(sorted_by)
|
||||
result = creator.accessible_cards
|
||||
result = result.indexed_by(indexed_by)
|
||||
result = result.sorted_by(sorted_by)
|
||||
result = result.where(id: card_ids) if card_ids.present?
|
||||
result = result.open unless include_closed_cards?
|
||||
result = result.by_engagement_status(engagement_status) if engagement_status.present?
|
||||
|
||||
Reference in New Issue
Block a user