Skip to content

Commit

Permalink
Merge pull request #10 from hudmol/find-missing-boxes
Browse files Browse the repository at this point in the history
subcontainer types are optional, so left join to keep those rows
  • Loading branch information
marktriggs authored Jul 14, 2016
2 parents f4efb18 + 414321f commit 4ba08b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/model/trees_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def containers_ds
TopContainer.linked_instance_ds
.join(:archival_object, :id => :instance__archival_object_id)
.join(:enumeration_value___top_container_type, :id => :top_container__type_id)
.join(:enumeration_value___sub_container_type_2, :id => :sub_container__type_2_id)
.join(:enumeration_value___sub_container_type_3, :id => :sub_container__type_3_id)
.left_join(:enumeration_value___sub_container_type_2, :id => :sub_container__type_2_id)
.left_join(:enumeration_value___sub_container_type_3, :id => :sub_container__type_3_id)
.filter(:archival_object__root_record_id => self.id)
.select(Sequel.as(:archival_object__id, :archival_object_id),
Sequel.as(:top_container__barcode, :top_container_barcode),
Expand All @@ -109,10 +109,10 @@ def fetch_container_info
row[:top_container_barcode] ? ('[' + row[:top_container_barcode] + ']') : nil].compact.join(': '),

# BoxType_2 Indicator_2
[row[:sub_container_type_2], row[:sub_container_indicator_2]].join(': '),
[row[:sub_container_type_2], row[:sub_container_indicator_2]].compact.join(': '),

# BoxType_3 Indicator_3
[row[:sub_container_type_3], row[:sub_container_indicator_3]].join(': '),
[row[:sub_container_type_3], row[:sub_container_indicator_3]].compact.join(': '),
].reject(&:empty?).join(', ')
end

Expand Down

0 comments on commit 4ba08b1

Please sign in to comment.