Calculate Billing Statistics for the Missing Period

Sometimes customers are experiencing the problem of missing billing statistics because of daemon, delayed jobs, cron, and raw statistics temporary failures. After the mentioned services get started, raw statistics data gets inserted into the DB and afterward aggregated into raw hourly statistics (in most of the cases). Having raw hourly stats in DB allows generating billing statistics based on it. That doesn't happen automatically because of peculiarities of billing statistics generation. However, it can be done manually running the rake task specifying the period (billing:calculate_hourly_stats_for_missed_period [:start_time, :end_time]).

Usage example:

RAILS_ENV=production rake billing:calculate_hourly_stats_for_missed_period\['2014-06-01 01:00:00','2014-06-05 23:00:00'\]