lib/updateagent/updaters/people_updater.rb in onebody-updateagent-0.4.3 vs lib/updateagent/updaters/people_updater.rb in onebody-updateagent-0.5.0

- old
+ new

@@ -13,28 +13,34 @@ check_for_missing_columns person_data = [] family_data = {} @data.each_with_index do |row, index| person, family = split_change_hash(row) + # massaging + if person.has_key?('email') + person['email_changed'] = false + end + if person.has_key?('relationships') + person['relationships_hash'] = Digest::SHA1.hexdigest(person['relationships'].split(',').sort.join(',')) + end + # link to cached family or cache new family if existing_family = family_data[family['legacy_id']] person['family'] = existing_family - if person.has_key?('email') - person['email_changed'] = false - end person_data << person else person['family'] = family - if person.has_key?('email') - person['email_changed'] = false - end person_data << person family['barcode_id_changed'] = false if family.has_key?('barcode_id') family_data[family['legacy_id']] = family end print "splitting family record #{index+1}\r" end puts @attributes << 'email_changed' if @attributes.include?('email') + if @attributes.include?('relationships') + @attributes << 'relationships_hash' + @attributes.delete('relationships') + end @data = person_data @attributes.reject! { |a| a =~ /^family_/ and a != 'family_id' } @family_agent = FamilyUpdater.new(family_data.values, @options) end