app/models/hierarchy/similarity.rb
# "check each rank in order of priority and return the respective weight on
# match"
"check each rank in order of priority and return the respective weight on
match"
" check each rank in order of priority and return the respective weight on match "
def compare_ancestries
    study_ancestry
    return nil if @ancestry_empty
    return 0 if @bad_kingdom
    if @kingdoms_match
      if @non_kingdoms_match
        return 1
      else
        return @ancestry_score = RANK_WEIGHTS["kingdom"] unless
          @both_ancestries_have_non_kingdoms
        return @ancestry_score = 0 unless allowed_to_match_at_kingdom_only?
      end
    end
    @ancestry_score = @ancestry_score
  end
def compare_ancestries study_ancestry return nil if @ancestry_empty return 0 if @bad_kingdom if @kingdoms_match if @non_kingdoms_match return 1 else return @ancestry_score = RANK_WEIGHTS [ "kingdom" ] unless @both_ancestries_have_non_kingdoms return @ancestry_score = 0 unless allowed_to_match_at_kingdom_only? end end @ancestry_score = @ancestry_score end
"check each rank in order of priority and return the respective weight on
match"
" check each rank in order of priority and return the respective weight on match "
# Never ever match bad kingdoms: # We matched on Kingdom AND something else, which is great! # We *only* had kingdoms to work with... If neither entry has other # ranks at all, return the score based on kingdom only: # So here we've got at least one entry with other ranks *available*, # but they didn't match. This is only okay if both entries have a rank # that allows this: # If we haven't returned, then we're looking at a pair of higher-level # entries that matched only at kingdom (which is fine)