app/controllers/programme_items_controller.rb
#
# Get the all the program items for a given person
#
Get the all the program items for a given person
Get the all the program items for a given person
def index
    if params[:person_id] 
      @person = Person.find(params[:person_id])
      assignments = @person.programmeItemAssignments.collect{|a| (a.programmeItem != nil) ? a : nil}.compact
      @assignments = assignments.sort{|a,b| (a.programmeItem.start_time && b.programmeItem.start_time) ? a.programmeItem.start_time <=> b.programmeItem.start_time : -1}
    end
  rescue => ex
    Rails.logger.error ex.message if Rails.env.development?
    Rails.logger.error ex.backtrace.join("\n\t") if Rails.env.development?
    render status: :bad_request, text: ex.message
  end
def index if params [ :person_id ] @person = Person . find ( params [ :person_id ] ) assignments = @person . programmeItemAssignments . collect { | a | ( a . programmeItem != nil ) ? a : nil } . compact @assignments = assignments . sort { | a , b | ( a . programmeItem . start_time && b . programmeItem . start_time ) ? a . programmeItem . start_time <=> b . programmeItem . start_time : - 1 } end rescue => ex Rails . logger . error ex . message if Rails . env . development? Rails . logger . error ex . backtrace . join ( "\n\t" ) if Rails . env . development? render status : :bad_request , text : ex . message end
Get the all the program items for a given person
Get the all the program items for a given person
# then we only get the items for a given person