Sha256: 8c58edbd4d5838b8b10718023ac8040472d13b47c9f4133d3f193548528a0adf

Contents?: true

Size: 618 Bytes

Versions: 33

Compression:

Stored size: 618 Bytes

Contents

class Dorsale::BillingMachine::SmallData::FilterStrategyByPaymentStatus < ::Agilibox::SmallData::FilterStrategy
  def apply(query, value)
    table_name = query.model.table_name

    if value == "paid"
      query.where(paid: true)
    elsif value == "unpaid"
      query.where(paid: false)
    elsif value == "pending"
      query
        .where(paid: false)
        .where("#{table_name}.due_date >= ?", Date.current)
    elsif value == "late"
      query
        .where(paid: false)
        .where("#{table_name}.due_date < ? OR #{table_name}.due_date IS NULL", Date.current)
    else
      query
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
dorsale-4.0.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.20.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.19.1 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.19.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.18.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.17.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.16.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.15.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.11 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.10 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.9 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.8 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.7 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.6 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.5 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.4 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.3 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.2 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.1 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb
dorsale-3.14.0 app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb