Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT count(id) as hits,
- LEFT(created_at,10) as created_on,
- event_id FROM `visits` WHERE (left(created_at,10) = '2008-08-19' and type = 'EventVisit') AND ( (`visits`.`type` = 'EventVisit' ) ) GROUP BY created_on, event_id ORDER BY created_on DESC, event_id ASC
- def self.report_for_day(day)
- find(:all,{
- :select => "count(id) as hits,
- LEFT(created_at,10) as created_on,
- event_id",
- :conditions => [ "left(created_at,10) = ? and type = ?", day, 'EventVisit'],
- :group => "created_on, event_id",
- :order => "created_on DESC, event_id ASC"
- })
- end
- Event.find(:all, :conditions => ["is_published = ? AND end_at > ?", true, (Time.now+30.days).to_s(:db) ] ) do |e|
- if e.tz.utc_offset == offset * 60 * 60
- find(:all,{
- :select => "count(id) as hits,LEFT(created_at,10) as created_on,event_id",
- :conditions => [ "created_at between ? and ?, and type = ? and event_id = e.id ", e.tz.now.beginning_of_day.to_s(:db), e.tz.now.end_of_day .to_s(:db), day, 'EventVisit'],
- :group => "created_on", #???
- :order => "created_on DESC"
- })
- end
- end
- end
Add Comment
Please, Sign In to add comment