schedules_controller.rb 777 Bytes
Newer Older
1 2
# Contains functionality for generating schedules.
class SchedulesController < ApplicationController
3
  include SchedulesHelper
4

5 6 7 8 9
  def show
    valid_crns = @cart.reject { |crn|
      s = CourseSection.find_by_crn(crn)
      s.nil?
    }
10

11
    @all = valid_crns.map { |crn|
12
      CourseSection.latest_by_crn(crn)
13
    }
Zac Wood's avatar
Zac Wood committed
14 15 16 17
    @without_online = @all.reject { |s|
      s.start_time == "TBA" || s.end_time == "TBA"
    }
    @events = generate_fullcalender_events(@without_online)
18
  end
Zac Wood's avatar
Zac Wood committed
19

20 21 22 23 24 25
  def view
    @all = params[:crns].split(',').map { |crn|
      CourseSection.latest_by_crn(crn)
    }
    @all.reject!(&:nil?)
    @without_online = @all.reject { |s|
Zac Wood's avatar
Zac Wood committed
26 27 28
      s.start_time == "TBA" || s.end_time == "TBA"
    }
    @events = generate_fullcalender_events(@without_online)
Zac Wood's avatar
Zac Wood committed
29
  end
30
end