app/models/service_learning/service_learning_position.rb
# Returns a textual description of the placements and how they are allocated to courses for this Position. Pass an +exclude+ option to 
# exclude a specific course from the breakdown list.
Returns a textual description of the placements and how they are allocated to courses for this Position. Pass an +exclude+ option to
exclude a specific course from the breakdown list.
Returns a textual description of the placements and how they are allocated to courses for this Position . Pass an + exclude + option to exclude a specific course from the breakdown list .
def placements_breakdown(delimiter = ", ", options = {})
    collection = options[:exclude] ? placements.reject{|p| p.course == options[:exclude]} : placements
    return nil if collection.empty?
    t = ""
    courses = {}
    collection.each do |p|
      courses.include?(p.course) ? courses[p.course] = courses[p.course]+1 : courses[p.course] = 1
    end
    courses.collect{|c,count| "#{c.title rescue "unallocated"} (#{count})"}.join(delimiter)
  end
def placements_breakdown ( delimiter = ", " , options = { } ) collection = options [ :exclude ] ? placements . reject { | p | p . course == options [ :exclude ] } : placements return nil if collection . empty? t = "" courses = { } collection . each do | p | courses . include? ( p . course ) ? courses [ p . course ] = courses [ p . course ] + 1 : courses [ p . course ] = 1 end courses . collect { | c , count | "#{c.title rescue "unallocated"} (#{count})" } . join ( delimiter ) end
Returns a textual description of the placements and how they are allocated to courses for this Position.
Returns a textual description of the placements and how they are allocated to courses for this Position .
#    courses.reject!{|c| c.course == options[:exclude]} if options[:exclude]
delimiter
options