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