comparison app/helpers/activities_helper.rb @ 1499:1c7af51e9409 live

Avoid showing institution "none" as busy
author Chris Cannam
date Fri, 21 Mar 2014 09:07:31 +0000
parents 441b66f148b6
children afce8026aaeb
comparison
equal deleted inserted replaced
1498:abde837f1224 1499:1c7af51e9409
136 def busy_institutions(events, count) 136 def busy_institutions(events, count)
137 authors = events.map do |e| 137 authors = events.map do |e|
138 e.event_author unless !e.respond_to?(:event_author) 138 e.event_author unless !e.respond_to?(:event_author)
139 end.compact 139 end.compact
140 institutions = authors.map do |a| 140 institutions = authors.map do |a|
141 if a.respond_to?(:ssamr_user_detail) and !a.ssamr_user_detail.nil? 141 if a.respond_to?(:ssamr_user_detail) and !a.ssamr_user_detail.nil? and a.ssamr_user_detail.institution_name != "none"
142 a.ssamr_user_detail.institution_name 142 a.ssamr_user_detail.institution_name
143 end 143 end
144 end 144 end
145 insthash = institutions.compact.sort.group_by { |i| i } 145 insthash = institutions.compact.sort.group_by { |i| i }
146 insthash = insthash.merge(insthash) { |k,v| v.length } 146 insthash = insthash.merge(insthash) { |k,v| v.length }