Skip to content

Commit 608e106

Browse files
Change available offerings and course offerings to instance variables
1 parent 59e1b93 commit 608e106

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

app/controllers/workouts_controller.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,14 @@ def find_offering
636636

637637
if !@course_offering
638638
# Let the user choose to enroll in a course_offering.
639-
available_offerings = []
640-
available_course_offerings = CourseOffering
639+
@available_offerings = []
640+
@available_course_offerings = CourseOffering
641641
.where(course: @course, term: @term)
642642
.select{ |co| co.self_enrollment_allowed? }
643643

644-
if available_course_offerings.count == 1
644+
if @available_course_offerings.count == 1
645645
# There is only one possible course offering. Continue on with it.
646-
@course_offering = available_course_offerings.first
646+
@course_offering = @available_course_offerings.first
647647
else
648648
# There are multiple or no possible course offerings. Render the selection page.
649649
render layout: 'one_column' and return
@@ -711,17 +711,17 @@ def find_offering
711711
end
712712
else
713713
# let the user choose to enroll in a course_offering
714-
existing_workout_offerings = workout_offerings
714+
@existing_workout_offerings = workout_offerings
715715
.uniq { |wo| wo.course_offering }
716716
.select { |wo| wo.course_offering.self_enrollment_allowed? }
717-
available_offerings = CourseOffering
717+
@available_offerings = CourseOffering
718718
.where(course: @course, term: @term)
719719
.select{ |co| co.self_enrollment_allowed? }
720720

721-
if available_offerings.count == 1
722-
@course_offering = available_offerings.first
721+
if @available_offerings.count == 1
722+
@course_offering = @available_offerings.first
723723
@workout_offering = @course_offering.workout_offerings
724-
.find{ |wo| existing_workout_offerings.include?(wo) }
724+
.find{ |wo| @existing_workout_offerings.include?(wo) }
725725

726726
# If we still don't have a workout offering, try to create it.
727727
@workout_offering ||= @course_offering.add_workout(

0 commit comments

Comments
 (0)