diff app/controllers/activities_controller.rb @ 1026:b42553f6df71 bibplugin_bibtex

Merge
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 13 Nov 2012 13:23:29 +0000
parents e3f78fa30a36
children bb32da3bea34
line wrap: on
line diff
--- a/app/controllers/activities_controller.rb	Mon Aug 06 12:33:23 2012 +0100
+++ b/app/controllers/activities_controller.rb	Tue Nov 13 13:23:29 2012 +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, 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, User.current, current_language])
       respond_to do |format|
         format.html {
           @events_by_day = events.group_by(&:event_date)