Method: ArAdRenderer#find_ads_multi

Defined in:
app/renderers/ar_ad_renderer.rb

#find_ads_multiObject

Finds ads that will be rendered. Subroutine of multi method.



55
56
57
58
59
60
61
62
63
64
# File 'app/renderers/ar_ad_renderer.rb', line 55

def find_ads_multi() #:nodoc:
  ads = ArAd.where( position: @opts[:position], active: true).to_a#, :valid_to.gt => Time.now, :valid_from.lt => Time.now).to_a
#p @opts, ads.size, '*-*-*-*'
  ads.delete_if { |ad| (ad.valid_to and ad.valid_to < Time.now) or 
                       (ad.valid_from and ad.valid_from > Time.now) or 
                       (ad.displays > 0 and ad.displayed >= ad.displays) or
                       (ad.clicks > 0 and ad.clicked >= ad.clicks) }
                   
  ads
end