class PostRunner::PersonalRecords::Record

The Record class stores a single speed or longest distance record. It also stores a reference to the Activity that contains the record.

Public Class Methods

new(p, result) click to toggle source
Calls superclass method
# File lib/postrunner/PersonalRecords.rb, line 99
def initialize(p, result)
  super(p)

  self.activity = result.activity
  self.sport = result.sport
  self.distance = result.distance
  self.duration = result.duration
  self.start_time = result.start_time
end

Public Instance Methods

to_table_row(t) click to toggle source
# File lib/postrunner/PersonalRecords.rb, line 109
def to_table_row(t)
  t.row((@duration.nil? ?
         [ 'Longest Distance', '%.3f km' % (@distance / 1000.0), '-' ] :
         [ PersonalRecords::SpeedRecordDistances[@sport][@distance],
           secsToHMS(@duration),
           @sport == 'running' ?
           speedToPace(@distance / @duration) :
           '%.1f' % (@distance / @duration * 3.6) ]) +
        [ @store['file_store'].ref_by_activity(@activity),
          ActivityLink.new(@activity, false),
          @start_time.strftime("%Y-%m-%d") ])
end