diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/info_request_event.rb | 12 | ||||
-rw-r--r-- | app/models/public_body.rb | 2 | ||||
-rw-r--r-- | app/models/track_thing.rb | 12 |
3 files changed, 22 insertions, 4 deletions
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index fbf70332d..4003217b0 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -134,11 +134,19 @@ class InfoRequestEvent < ActiveRecord::Base end def latest_variety - self.info_request.get_last_event.variety + for event in self.info_request.info_request_events.reverse + if !event.variety.nil? and !event.variety.empty? + return event.variety + end + end end def latest_status - self.info_request.get_last_event.calculated_state + for event in self.info_request.info_request_events.reverse + if !event.calculated_state.nil? and !event.calculated_state.empty? + return event.calculated_state + end + end end def waiting_classification diff --git a/app/models/public_body.rb b/app/models/public_body.rb index c19433704..81149e3c2 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -206,7 +206,7 @@ class PublicBody < ActiveRecord::Base return self.created_at.strftime("%Y%m%d%H%M%S") end def variety - "authority" + return "authority" end # if the URL name has changed, then all requested_from: queries diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index f993b4fe8..1cd957549 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -105,9 +105,19 @@ class TrackThing < ActiveRecord::Base return track_thing end - def TrackThing.create_track_for_search_query(query) + def TrackThing.create_track_for_search_query(query, variety_postfix = nil) track_thing = TrackThing.new track_thing.track_type = 'search_query' + if !(query =~ /variety:/) + case variety_postfix + when "requests" + query += " variety:sent" + when "users" + query += " variety:user" + when "authorities" + query += " variety:authority" + end + end track_thing.track_query = query return track_thing end |