master
1class Progress
2 attr_reader :exercise, :workout
3
4 def initialize(workout, exercise)
5 @exercise = exercise
6 @workout = workout
7 end
8
9 def to_sets
10 @sets ||= sets.pluck(:actual_repetitions).compact
11 end
12
13 def max_weight
14 sets.maximum(:target_weight)
15 end
16
17 def sets
18 workout.sets.work.for(exercise).in_order
19 end
20
21 def status
22 "#{to_sets.join('/')} @ #{max_weight} lbs" if to_sets.any?
23 end
24end