libraries/AssociationManagement.rb
def save_data_matrix_alt(coll, matrix, offset: [0, 0])
      pm = coll.part_matrix
      das = []

      uniq_keys = matrix.flatten.map(&:keys).flatten.uniq
      dms_by_key = {}
      uniq_keys.each do |key|
        dms_by_key[key] = coll.data_matrix(key)
      end

      coll.each_row_col(matrix, offset: offset) do |x, y, ox, oy|
        next unless !matrix[x][y].nil? && pm[ox][oy] # this part has das
        matrix[x][y].each do |k, v|
          if pm[ox][oy]
            if dms_by_key[k][ox][oy]
              da = dms_by_key[k][ox][oy]
              da.object = { k => v }.to_json
              das << da
            else
              das << pm[ox][oy].lazy_associate(k, v)
            end
          end
        end
      end

      das
    end
# saves part_data to the data associations of constituent parts.
# achieves forward compatibility with AQ Part update
# built off of set_data_matrix from collection.rb
saves part_data to the data associations of constituent parts.
achieves forward compatibility with AQ Part update
built off of set_data_matrix from collection.rb
saves part_data to the data associations of constituent parts . achieves forward compatibility with AQ Part update built off of set_data_matrix from collection . rb
def save_data_matrix_alt(coll, matrix, offset: [0, 0])
      pm = coll.part_matrix
      das = []
      uniq_keys = matrix.flatten.map(&:keys).flatten.uniq
      dms_by_key = {}
      uniq_keys.each do |key|
        dms_by_key[key] = coll.data_matrix(key)
      end
      coll.each_row_col(matrix, offset: offset) do |x, y, ox, oy|
        next unless !matrix[x][y].nil? && pm[ox][oy] 
        matrix[x][y].each do |k, v|
          if pm[ox][oy]
            if dms_by_key[k][ox][oy]
              da = dms_by_key[k][ox][oy]
              da.object = { k => v }.to_json
              das << da
            else
              das << pm[ox][oy].lazy_associate(k, v)
            end
          end
        end
      end
      das
    end
def save_data_matrix_alt ( coll , matrix , offset : [ 0 , 0 ] ) pm = coll . part_matrix das = [ ] uniq_keys = matrix . flatten . map ( & :keys ) . flatten . uniq dms_by_key = { } uniq_keys . each do | key | dms_by_key [ key ] = coll . data_matrix ( key ) end coll . each_row_col ( matrix , offset : offset ) do | x , y , ox , oy | next unless ! matrix [ x ] [ y ] . nil? && pm [ ox ] [ oy ] matrix [ x ] [ y ] . each do | k , v | if pm [ ox ] [ oy ] if dms_by_key [ k ] [ ox ] [ oy ] da = dms_by_key [ k ] [ ox ] [ oy ] da . object = { k => v } . to_json das << da else das << pm [ ox ] [ oy ] . lazy_associate ( k , v ) end end end end das end
saves part_data to the data associations of constituent parts.
saves part_data to the data associations of constituent parts .
# this part has das
coll
matrix
offset