Sha256: 7a5f823647ff9e42724dc8e257ba9ee048a4a3c0281efd5fb0f8dc36302290b9
Contents?: true
Size: 822 Bytes
Versions: 18
Compression:
Stored size: 822 Bytes
Contents
module Dorsale module BillingMachine module SmallData class FilterStrategyByPaymentStatus < ::Dorsale::SmallData::FilterStrategy def apply(query, value) table_name = query.model.table_name if value == "paid" return query.where("#{table_name}.paid = ?", true) elsif value == "unpaid" return query.where("#{table_name}.paid = ?", false) elsif value == "pending" return query.where("#{table_name}.paid = ? and #{table_name}.due_date >= ?", false, Date.today) elsif value == "late" return query.where("#{table_name}.paid = ? and (#{table_name}.due_date < ? or #{table_name}.due_date is null)", false, Date.today) else return query end end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems