Method: PostRunner::FitFileStore#activities

Defined in:
lib/postrunner/FitFileStore.rb

#activitiesArray of FFS_Activity

Returns List of stored activities.

Returns:



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/postrunner/FitFileStore.rb', line 217

def activities
  list = []
  @store['devices'].each do |id, device|
    list += device.activities
  end
  # Sort the activites by timestamps (newest to oldest). As the list is
  # composed from multiple devices, there is a small chance of identical
  # timestamps. To guarantee a stable list, we use the long UID of the
  # device in cases of identical timestamps.
  list.sort! do |a1, a2|
    a1.timestamp == a2.timestamp ?
      a1.device.long_uid <=> a2.device.long_uid :
      a2.timestamp <=> a1.timestamp
  end

  list
end