Method: PostRunner::FitFileStore#monthly_report
- Defined in:
- lib/postrunner/FitFileStore.rb
#monthly_report(day) ⇒ Object
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/postrunner/FitFileStore.rb', line 415 def monthly_report(day) # 'day' specifies the current month. It must be in the form of # YYYY-MM-01. But we don't know what timezone the watch was set to for a # given date. The files are always named after the moment of finishing # the recording expressed as GMT time. Each file contains information # about the time zone for the specific file. Recording is always flipped # to a new file at midnight GMT but there are usually multiple files per # GMT day. day_as_time = Time.parse(day).gmtime # To get weekly intensity minutes we need 7 days of data prior to the # current month start and 1 after to inclide the following night. We add # at least 12 extra hours to accomondate time zone changes. monitoring_files = monitorings(day_as_time - 8 * 24 * 60 * 60, day_as_time + 32 * 24 * 60 * 60) puts MonitoringStatistics.new(monitoring_files).monthly(day) end |