Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
proceps committed Dec 5, 2018
1 parent 3b21a50 commit 60a667c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion app/models/protonym.rb
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,10 @@ def original_combination_elements
# apply gender to everything but the last
total = r.count - 1
r.each_with_index do |j, i|
unless (j.type =~ /genus/i) || i == total
if j.type =~ /enus/ || i == total
g = nil
else
#unless (j.type =~ /genus/) || i == total
g = gender
end
elements.merge! j.combination_name(g)
Expand Down
2 changes: 1 addition & 1 deletion app/models/taxon_name_relationship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def sv_objective_synonym_relationship
s = self.subject_taxon_name
o = self.object_taxon_name
if (s.type_taxon_name != o.type_taxon_name ) || !s.has_same_primary_type(o)
soft_validations.add(:type, "Objective synonyms {s.cached_html} and #{o.cached_html} should have the same type")
soft_validations.add(:type, "Objective synonyms #{s.cached_html} and #{o.cached_html} should have the same type")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/taxon_name_relationship/original_combination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def monomial_prefix
# TODO: reconcile this format with that of full_name_hash
def combination_name(name_gender = nil)
elements = [monomial_prefix]
if !subject_taxon_name.verbatim_name.blank? # subject_taxon_name ?! TODO ?! - provide verbatim test
elements.push subject_taxon_name.verbatim_name
if !subject_taxon_name.verbatim_name.blank? && name_gender.nil?
elements.push subject_taxon_name.verbatim_name
else
elements.push subject_taxon_name.genderized_name(name_gender)
end
Expand Down
4 changes: 3 additions & 1 deletion spec/models/taxon_name_specs/cached_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
species.update(
masculine_name: 'aus',
feminine_name: 'aa',
neuter_name: 'aum'
neuter_name: 'aum',
verbatim_name: 'aum'
)

subspecies.update(
Expand All @@ -72,6 +73,7 @@
end

specify '#cached_original_combination' do
subspecies.save
expect(subspecies.cached_original_combination).to eq('Aus aa bus')
end

Expand Down

0 comments on commit 60a667c

Please sign in to comment.