app/models/log_entry.rb
def sport_time
    activity_times = {}
    workouts = self.workouts
    workouts.each do |workout|
      total_minutes_sport = workout.total_completed
      activity = workout.activity_id
      unless activity == nil
      if activity_times[activity] == nil
        activity_times[activity.to_s] = total_minutes_sport
      else
        activity_times[activity.to_s] += total_minutes_sport
      end
      end
    end
    return activity_times
  end
#for the donut graph grab the total minutes as well as the sport and place in an array
for the donut graph grab the total minutes as well as the sport and place in an array
for the donut graph grab the total minutes as well as the sport and place in an array
def sport_time
    activity_times = {}
    workouts = self.workouts
    workouts.each do |workout|
      total_minutes_sport = workout.total_completed
      activity = workout.activity_id
      unless activity == nil
      if activity_times[activity] == nil
        activity_times[activity.to_s] = total_minutes_sport
      else
        activity_times[activity.to_s] += total_minutes_sport
      end
      end
    end
    return activity_times
  end
def sport_time activity_times = { } workouts = self . workouts workouts . each do | workout | total_minutes_sport = workout . total_completed activity = workout . activity_id unless activity == nil if activity_times [ activity ] == nil activity_times [ activity . to_s ] = total_minutes_sport else activity_times [ activity . to_s ] += total_minutes_sport end end end return activity_times end
for the donut graph grab the total minutes as well as the sport and place in an array
for the donut graph grab the total minutes as well as the sport and place in an array