-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treat punctuation as optional for org name conviction checks #565
Conversation
https://eaflood.atlassian.net/browse/RUBY-741 This fixes an issue spotted in QA. Punctuation should be treated as optional when matching organisation names - for example, if a user enters "Waste Not (Want Not) UK" that should still match a record called "Waste Not Want Not UK".
@@ -88,15 +88,34 @@ def self.matching_organisations(name:, company_no: nil) | |||
private_class_method def self.org_name_search_term(term) | |||
return if term.blank? | |||
|
|||
# Trim trailing full stops | |||
term_without_trailing_full_stops = term.gsub(/\.$/, "") | |||
# The steps for processing the org name must be done in this order: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I have all my code written like this, please? I might then finally have a clue what everything is doing! ❤️ 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
end | ||
|
||
private_class_method def self.term_with_optional_punctuation(term) | ||
# These are characters we want to treat as optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we reflect this in the variable's name? Like: optional_chars
instead of punctuation_chars
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That probably makes sense. I got what was going on without issue so didn't spot this, but now that you highlight it, I see why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cintamani Good shout! Updated: 4c1852a
4c1852a
https://eaflood.atlassian.net/browse/RUBY-741
This fixes an issue spotted in QA. Punctuation should be treated as optional when matching organisation names - for example, if a user enters "Waste Not (Want Not) UK" that should still match a record called "Waste Not Want Not UK".