I'm trying to generate a report for the average number of calls a person
makes per-day. The following generates the correct list, but if a user
didn't make any calls a certain day it doesn't show up.

from_date = Time.now.at_beginning_of_month.to_s(:db)

to_date = Time.now.tomorrow.to_s(:db)

ave_calls = @current_user.calls.average(:num_of_calls,
    :group => "DATE(calls.start_time_stamp)",
    :conditions => ["calls.created_at BETWEEN ? AND ?",
    from_date, to_date])

What is the best way of doing this? An example I have right now, I have
data from August 3rd til Today, no calls were made August 2nd or August
1st. The list comes back and starts at the 3rd.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to