Skip to content
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

Merged
merged 4 commits into from
Nov 21, 2019

Conversation

irisfaraway
Copy link
Member

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".

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".
@irisfaraway irisfaraway added the bug Something isn't working label Nov 19, 2019
@irisfaraway irisfaraway self-assigned this Nov 19, 2019
Cruikshanks
Cruikshanks previously approved these changes Nov 20, 2019
@@ -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:
Copy link
Member

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! ❤️ 😁

cintamani
cintamani previously approved these changes Nov 20, 2019
Copy link
Contributor

@cintamani cintamani left a 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
Copy link
Contributor

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 :)

Copy link
Member

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.

Copy link
Member Author

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

@irisfaraway irisfaraway merged commit 8bd459d into master Nov 21, 2019
@irisfaraway irisfaraway deleted the fix/conv-match-punctuation branch November 21, 2019 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants