aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/workbench.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/workbench.rb')
-rw-r--r--app/models/workbench.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/workbench.rb b/app/models/workbench.rb
index e36589210..b80fa64ac 100644
--- a/app/models/workbench.rb
+++ b/app/models/workbench.rb
@@ -4,6 +4,7 @@ class Workbench < ActiveRecord::Base
belongs_to :line_referential
belongs_to :stop_area_referential
belongs_to :output, class_name: 'ReferentialSuite'
+ belongs_to :workgroup
has_many :lines, -> (workbench) { Stif::MyWorkbenchScopes.new(workbench).line_scope(self) }, through: :line_referential
has_many :networks, through: :line_referential
@@ -14,6 +15,7 @@ class Workbench < ActiveRecord::Base
has_many :workbench_imports
has_many :compliance_check_sets
has_many :compliance_control_sets
+ has_many :merges
validates :name, presence: true
validates :organisation, presence: true
@@ -29,7 +31,12 @@ class Workbench < ActiveRecord::Base
if line_ids.empty?
Referential.none
else
- Referential.joins(:metadatas).where(['referential_metadata.line_ids && ARRAY[?]::bigint[]', line_ids]).ready
+ workgroup
+ .referentials
+ .joins(:metadatas)
+ .where(['referential_metadata.line_ids && ARRAY[?]::bigint[]', line_ids])
+ .ready
+ .not_in_referential_suite
end
end