lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.5.6 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.5.7
- old
+ new
@@ -118,10 +118,11 @@
def parent_id
parent_id_field = @core_fields[:highertaxonid] || @core_fields[:parentnameusageid]
end
def calculate_classification_path
+ @paths_num = 0
@normalized_data.each do |taxon_id, taxon|
next if !taxon.classification_path.empty?
begin
get_classification_path(taxon)
rescue DarwinCore::ParentNotCurrentError
@@ -129,9 +130,11 @@
end
end
end
def get_classification_path(taxon)
+ @paths_num += 1
+ DarwinCore.logger_write(@dwc.object_id, "Calculated %s paths" % @paths_num) if @paths_num % 10000 == 0
return if !taxon.classification_path.empty?
current_node = {taxon.id => {}}
if DarwinCore.nil_field?(taxon.parent_id)
taxon.classification_path << taxon.current_name_canonical
taxon.classification_path_id << taxon.id