Skip to content

Instantly share code, notes, and snippets.

Last active Dec 28, 2015
What would you like to do?
Find broken data
column :reason, 4
column :account_id, 5
column :contact_id, 6
column :closed_date, 7
column :total_value_mars_resource_usage, 8
column :total_value_mars_resources, 9
column :last_modified_date, 10
column :eir_case_date, 11
autfull_objs = aut_schema.conform(autfull, :skip_first => true).to_a
# Get prod data: Select Id, CaseNumber, CGT__c, Case_Grand_Total_2__c,
# U_of_T_Case_Total__c, T_V__c,LastModifiedDate,EIR_Case_Date_cpa__c from Case where Case.RecordTypeId =
# '01250000000UGi5' OR Case.RecordTypeId = '012500000005D0y'
production ='production.csv')
production_schema = do
column :the_id, 0
column :case_number, 1
column :case_grand_total, 2
column :case_grand_total_2, 3 do |x| x.to_i end
column :u_of_t_case_total, 4
column :total_value, 5 do |x| x.to_i end
column :last_modified_date, 6 do |x| Time.parse(x) end
production_objs = production_schema.conform(production, :skip_first => true).to_a
puts "Id,Current Total Value,New Total Value,Case Number,Diff"
@total_borked = []
@total_borked =, :in_processes => 8) do |new|
@old = production_objs.find {|x| x.the_id == new.the_id }
next if @old.nil? #We didn't have that data at AUT cut time
next if @old.last_modified_date.year < 2013
next if @old.last_modified_date >,10,30)
diff = new.total_value_resources - @old.case_grand_total_2
unless new.total_value_resources == @old.case_grand_total_2
"#{@old.the_id},#{@old.case_grand_total_2},#{new.total_value_resources}, #{@old.case_number}, #{diff}"
puts @total_borked.length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment