diff app/controllers/activities_controller.rb @ 1116:bb32da3bea34 redmine-2.2-integration

Merge from live
author Chris Cannam
date Mon, 07 Jan 2013 14:41:20 +0000
parents 433d4f72a19b e3f78fa30a36
children 4f746d8966dd
line wrap: on
line diff
--- a/app/controllers/activities_controller.rb	Mon Jan 07 12:01:42 2013 +0000
+++ b/app/controllers/activities_controller.rb	Mon Jan 07 14:41:20 2013 +0000
@@ -40,7 +40,22 @@
 
     events = @activity.events(@date_from, @date_to)
 
-    if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, events.size, 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.respond_to?(:ssamr_user_detail) and
+          !e.event_author.ssamr_user_detail.nil? 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, events.size, User.current, current_language])
       respond_to do |format|
         format.html {
           @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}