1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

fix debugging footprints

This commit is contained in:
Sylvain 2021-05-17 17:04:52 +02:00
parent 58287d7cee
commit 1f9a7ba6cc
2 changed files with 16 additions and 12 deletions

View File

@ -48,16 +48,20 @@ class FootprintService
columns = FootprintService.footprint_columns(klass)
current = FootprintService.footprint_data(klass, item, array: true)
saved = FootprintDebug.find_by(footprint: item.footprint, klass: klass.name)
others = FootprintDebug.where('klass = ? AND data LIKE ? AND id != ?', klass, "#{item.id}%", saved.id)
puts "Debug footprint for #{klass} [ id: #{item.id} ]"
puts '-----------------------------------------'
puts "columns: [ #{columns.join(', ')} ]"
puts "current: #{current}"
puts " saved: #{saved.format_data(item.id)}"
puts '-----------------------------------------'
puts "other possible matches IDs: #{others.map(&:id)}"
puts '-----------------------------------------'
item.footprint_children.map(&:debug_footprint)
if saved.nil?
puts "Debug data not found for #{klass} [ id: #{item.id} ]"
else
others = FootprintDebug.where('klass = ? AND data LIKE ? AND id != ?', klass, "#{item.id}%", saved.id)
puts "Debug footprint for #{klass} [ id: #{item.id} ]"
puts '-----------------------------------------'
puts "columns: [ #{columns.join(', ')} ]"
puts "current: #{current}"
puts " saved: #{saved.format_data(item.id)}"
puts '-----------------------------------------'
puts "other possible matches IDs: #{others.map(&:id)}"
puts '-----------------------------------------'
item.footprint_children.map(&:debug_footprint)
end
end
private

View File

@ -15,7 +15,7 @@ class Integrity::ArchiveHelper
Invoice.where('created_at > ?', last_period.end_at).order(:id).each do |i|
next if i.check_footprint
puts i.debug_footprint
i.debug_footprint
raise "Invalid footprint for invoice #{i.id}"
end
else
@ -23,7 +23,7 @@ class Integrity::ArchiveHelper
Invoice.order(:id).all.each do |i|
next if i.check_footprint
puts i.debug_footprint
i.debug_footprint
raise "Invalid footprint for invoice #{i.id}"
end
end