Mercurial > hg > soundsoftware-site
diff app/controllers/activities_controller.rb @ 1009:066b55d7c053 browsing
Add busy institutions list
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Mon, 12 Nov 2012 13:34:32 +0000 |
parents | 0c939c159af4 |
children | e3f78fa30a36 |
line wrap: on
line diff
--- a/app/controllers/activities_controller.rb Mon Nov 12 13:34:21 2012 +0000 +++ b/app/controllers/activities_controller.rb Mon Nov 12 13:34:32 2012 +0000 @@ -40,7 +40,20 @@ events = @activity.events(@date_from, @date_to) - if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language]) + @institution_name = params[:institution] + if !@institution_name.blank? + events = events.select do |e| + e.respond_to?(:event_author) and e.event_author and + e.event_author.ssamr_user_detail.institution_name == @institution_name + end + if events.empty? + # We don't want to dump into the output any arbitrary string + # from the URL that has no matching events + @institution_name = "" + end + end + + if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, @institution_name, events.first, User.current, current_language]) respond_to do |format| format.html { @events_by_day = events.group_by(&:event_date)