- <% if presenter.labware.parents&.any? { |parent| parent.purpose.present? } %>
- <%= render partial: 'labware/parent_labware_item', collection: presenter.labware.parents, as: :labware %>
+ <% if valid_parents %>
+ <%= render partial: 'labware/parent_labware_item', collection: valid_parents, as: :labware %>
<% else %>
No parents found
<% end %>
@@ -16,12 +20,12 @@
Children
- <%= content_tag :span, presenter.labware.children.size, class: "badge badge-pill badge-secondary" if presenter.labware.children&.any? %>
+ <%= content_tag :span, valid_children.size, class: "badge badge-pill badge-secondary" %>
- <% if presenter.labware.children&.any? { |child| child.purpose.present? } %>
- <%= render partial: 'labware/child_labware_item', collection: presenter.labware.children, as: :labware, locals: { presenter: presenter, open_in_new_window: true } %>
+ <% if valid_children %>
+ <%= render partial: 'labware/child_labware_item', collection: valid_children, as: :labware, locals: { presenter: presenter, open_in_new_window: true } %>
<% else %>
No children found
<% end %>