Ruby on Rails - Percentage of Time More Than One Call is Active Per Hour
I have a RoR application that runs reports on a database of phone calls logged from a help desk. I've been asked to provide a report that shows the percentage of time, each hour, that more than one technician is on the phone. The dat开发者_如何学Pythonabase logs the call id, technician name, and call created at and end time in Y-M-D-H-M-S. Can anyone suggest a way I can do this? Thank you.
I don't see any problem at all from what I understand.
for each technician
look up the entries in the database and get the call created_at and end time
for each entry above
total_time += end_time.to_seconds - created_at_time.to_seconds
Find the difference between the starting time and the end time, you want to track the activity of a technician.
You get the %age of time this way. To get this for each hour, simply convert the time in hours and you are set to go.
精彩评论