Skip to content

Commit 6c16cdf

Browse files
committed
Update quality_checks.rb
1 parent 8c9daa1 commit 6c16cdf

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

app/models/name/quality_checks.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ class QcWarning
156156
)
157157
},
158158
failure: lambda { |w|
159-
w.name.base_name !~ /\A[A-Z][a-z ]+( subsp\. )?[a-z ]+\z/
159+
regexp =
160+
case w.name.inferred_rank
161+
when 'subspecies'; /\A[A-Z][a-z]+ [a-z]+ subsp\. [a-z]+\z/
162+
when 'species'; /\A[A-Z][a-z]+ [a-z]+\z/
163+
else /\A[A-Z][a-z]+\z/
164+
end
165+
w.name.base_name !~ regexp
160166
}
161167
}.merge(@@link_to_edit_spelling),
162168
binary_name_above_species: {
@@ -467,15 +473,15 @@ class QcWarning
467473
area: :nomenclature,
468474
recommendations: %w[19],
469475
scope: lambda { |w| w.name.type_is_genome? && w.name.isolate? },
470-
failure: lambda { |w| !genome.strain.present? }
476+
failure: lambda { |w| !w.name.genome.strain.present? }
471477
}.merge(@@link_to_edit_type),
472478
unavailable_reference_strain: {
473479
# TODO: Update if the paratype amendment is implemented to 1 collection
474480
message: 'If isolated, reference strains should be submitted to two ' \
475481
'culture collections',
476482
area: :nomenclature,
477483
recommendations: %w[19],
478-
scope: lambda { |w| w.name.type_is_genome? && genome.strain.present? },
484+
scope: lambda { |w| w.name.type_is_genome? && w.name.genome.strain.present? },
479485
failure: lambda { |w| w.name.genome.strain.collections.count < 2 }
480486
}.merge(@@link_to_edit_type),
481487
# When a strain belonging to a taxon named under the SeqCode is
@@ -633,7 +639,8 @@ class QcWarning
633639
w.name.inferred_rank == 'species' && w.name.parent.present?
634640
},
635641
failure: lambda { |w|
636-
!w.name.parent.validated? && !w.name.register&.names&.include?(parent)
642+
!w.name.parent.validated? &&
643+
!w.name.register&.names&.include?(w.name.parent)
637644
}
638645
}.merge(@@link_to_edit_parent),
639646
# - Rule 26 Note 2

0 commit comments

Comments
 (0)