lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.4.8 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.4.9

- old
+ new

@@ -37,10 +37,11 @@ def normalize @res = {} ingest_core calculate_classification_path + require 'ruby-debug'; debugger ingest_extensions @res end private @@ -126,14 +127,14 @@ rescue NoMethodError #name has a parent which is not a current name error = "The parent of the taxon \'#{taxon.current_name}\' is deprecated" @error_names << {:name => taxon, :error => error} raise DarwinCore::ParentNotCurrentError, error end - if parent_cp - taxon.classification_path += parent_cp + [taxon.current_name_canonical] - else + if parent_cp.empty? get_classification_path(@res[taxon.parent_id]) taxon.classification_path += @res[taxon.parent_id].classification_path + [taxon.current_name_canonical] + else + taxon.classification_path += parent_cp + [taxon.current_name_canonical] end end end def ingest_extensions