app/services/c100_app/permission/application_rules.rb
def relationships_require_permission?
        c100_application.relationships.with_permission_data.one? do |relationship|
          next if can_apply_for?(
            ALL_ORDERS, relationship: relationship, child_orders: []
          )

          # Following checks are based on the orders selected for this child
          child_orders = relationship.minor.child_order.orders

          next if can_apply_for?(
            CAO_ORDERS, relationship: relationship, child_orders: child_orders
          )

          next if can_apply_for?(
            CAO_HOME_ORDERS, relationship: relationship, child_orders: child_orders
          )

          # If we reach this point, permission is required no matter what for at
          # least one child, and there is no point looping through the rest
          break PERMISSION_REQUIRED
        end
      end
# Only loop through relationships that entered the non-parents journey,
# i.e. those having at least the first of those attributes as not `nil`.
#
Only loop through relationships that entered the non-parents journey,
i.e. those having at least the first of those attributes as not `nil`.
Only loop through relationships that entered the non - parents journey i . e . those having at least the first of those attributes as not ` nil ` .
def relationships_require_permission?
        c100_application.relationships.with_permission_data.one? do |relationship|
          next if can_apply_for?(
            ALL_ORDERS, relationship: relationship, child_orders: []
          )
          child_orders = relationship.minor.child_order.orders
          next if can_apply_for?(
            CAO_ORDERS, relationship: relationship, child_orders: child_orders
          )
          next if can_apply_for?(
            CAO_HOME_ORDERS, relationship: relationship, child_orders: child_orders
          )
          break PERMISSION_REQUIRED
        end
      end
def relationships_require_permission? c100_application . relationships . with_permission_data . one? do | relationship | next if can_apply_for? ( ALL_ORDERS , relationship : relationship , child_orders : [ ] ) child_orders = relationship . minor . child_order . orders next if can_apply_for? ( CAO_ORDERS , relationship : relationship , child_orders : child_orders ) next if can_apply_for? ( CAO_HOME_ORDERS , relationship : relationship , child_orders : child_orders ) break PERMISSION_REQUIRED end end
Only loop through relationships that entered the non-parents journey,
i.e.
Only loop through relationships that entered the non - parents journey i . e .
# Following checks are based on the orders selected for this child # If we reach this point, permission is required no matter what for at # least one child, and there is no point looping through the rest