def calculate_duration
      @duration = 0
      if @tracks.nil? || @tracks.size.zero? || @tracks[0].segments.nil? || @tracks[0].segments.size.zero?
        return @duration
      end
      @duration = (@tracks[-1].segments[-1].points[-1].time - @tracks.first.segments.first.points.first.time)
    rescue StandardError
      @duration = 0
    end
def calculate_duration
      @duration = 0
      if @tracks.nil? || @tracks.size.zero? || @tracks[0].segments.nil? || @tracks[0].segments.size.zero?
        return @duration
      end
      @duration = (@tracks[-1].segments[-1].points[-1].time - @tracks.first.segments.first.points.first.time)
    rescue StandardError
      @duration = 0
    end
Calculates and sets the duration attribute by subtracting the time on
 the very first point from the time on the very last point.