Skip to content

Commit

Permalink
Restructure constraints
Browse files Browse the repository at this point in the history
More readable
  • Loading branch information
kdp-cloud committed Oct 22, 2024
1 parent fc0a0b0 commit 675a39b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/seek/samples/sample_type_editing_constraints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def allow_required?(attr)

attr = attr.accessor_name
end
if attr
!blanks?(attr)
else
!samples?
end

return false unless attr
return !blanks?(attr) if samples?

true
end

# an attribute could be removed if all are currently blank
Expand All @@ -56,11 +56,10 @@ def allow_name_change?(attr)

attr = attr.accessor_name
end
if attr
samples.all?(&:can_edit?)
else
true
end
return false unless attr
return samples.all?(&:can_edit?) if samples?

true
end

# whether the type for the attribute can be changed
Expand Down

0 comments on commit 675a39b

Please sign in to comment.