Revision 1013:b98f60a6d231 app

View differences:

app/helpers/activities_helper.rb
13 13
  end
14 14

  
15 15
  def busy_institutions(events, count)
16
    authors = events.map { |e| e.event_author unless !e.respond_to?(:event_author) }.compact
17
    institutions = authors.map { |a| a.ssamr_user_detail.institution_name }
16
    authors = events.map do |e|
17
      e.event_author unless !e.respond_to?(:event_author) 
18
    end.compact
19
    institutions = authors.map do |a|
20
      if a.respond_to?(:ssamr_user_detail) and !a.ssamr_user_detail.nil?
21
        a.ssamr_user_detail.institution_name
22
      end
23
    end
18 24
    insthash = institutions.compact.sort.group_by { |i| i }
19 25
    insthash = insthash.merge(insthash) { |k,v| v.length }
20 26
    threshold = insthash.values.sort.last(count).first

Also available in: Unified diff