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.
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.
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.
Why would a day with no calls appear? Its just reporting the DB data in
an aggregated format.
Merge the returned ave_calls with a list built out of an iteration of
from_date to to_date by day to fill the gaps.
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.
Why would a day with no calls appear? Its just reporting the DB data in
an aggregated format.
Merge the returned ave_calls with a list built out of an iteration of
from_date to to_date by day to fill the gaps.
At first, I just stuck call_aves into the value for Open Flash Charts,
and it broke it, kind’ve looked like it went into an infinite loop. So I
went into my debugger to see what was happening.
How do I get this to go up by the day, not the second?
Well if you use dates rather than times that happens for free (since +
1 for a date means + 1 day), if not then you just need to put some
time values in an array, incrementing by a day at a time ( + 1.days or
using advance for example)
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.