diff options
| author | Xinhui | 2016-11-09 11:47:02 +0100 | 
|---|---|---|
| committer | Xinhui | 2016-11-09 11:47:17 +0100 | 
| commit | 2ca92317d4dc06992e93b39202fbc3231c8cac4d (patch) | |
| tree | d8ec68c092d48889234127e18d8cec6f36b32259 /lib/stif | |
| parent | e5bdfe49e120f6e703e63d05fad9e53ea499b58e (diff) | |
| download | chouette-core-2ca92317d4dc06992e93b39202fbc3231c8cac4d.tar.bz2 | |
Refactoring MyWorkbenchScopes with initial_scope
Refs #1787
Diffstat (limited to 'lib/stif')
| -rw-r--r-- | lib/stif/my_workbench_scopes.rb | 11 | 
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/stif/my_workbench_scopes.rb b/lib/stif/my_workbench_scopes.rb index ed3432ad3..7e4500a7d 100644 --- a/lib/stif/my_workbench_scopes.rb +++ b/lib/stif/my_workbench_scopes.rb @@ -1,20 +1,19 @@  class Stif::MyWorkbenchScopes -  attr_accessor :organisation +  attr_accessor :workbench    def initialize(workbench)      @workbench = workbench    end -  def line_scope -    scope = Chouette::Line -    ids   = self.parse_functional_scope -    ids ? scope.where(objectid: ids) : scope.all +  def line_scope(initial_scope) +    ids = self.parse_functional_scope +    ids ? initial_scope.where(objectid: ids) : initial_scope    end    def parse_functional_scope      return false unless @workbench.organisation.sso_attributes      begin -      line_ids = JSON.parse @workbench.organisation.sso_attributes['functional_scope'] +      JSON.parse @workbench.organisation.sso_attributes['functional_scope']      rescue Exception => e        Rails.logger.error "MyWorkbenchScopes : #{e}"      end  | 
