Last active
February 11, 2016 21:02
-
-
Save adelevie/de68e07a1064ddf89828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AuctionQuery | |
class Base | |
def initialize(relation = Auction.all) | |
@relation = relation | |
end | |
end | |
class DeliveryDeadlineExpired < Base | |
def call | |
@relation.where('delivery_deadline < ?', Time.zone.now) | |
end | |
end | |
class Accepted < Base | |
def call | |
@relation.where(result: 'accepted') | |
end | |
end | |
class Delivered < Base | |
def call | |
@relation.where.not(delivery_url: [nil, ""]) | |
end | |
end | |
class CapSubmitted < Base | |
@relation.where.not(cap_proposal_url: [nil, ""]) | |
end | |
class Paid < Base | |
@relation.where(awardee_paid_status: 'paid') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment