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

Update / test remove MP letters task #9089

Merged
merged 1 commit into from
May 30, 2024

Conversation

richardTowers
Copy link
Contributor

There were a few edge cases which came up when I ran this task last night:

  1. MySQL LIKE statements are case insensitive, so the query found things like "Francis Implementation Team" (as it's got a lower case mp in) (not sure why this is in the letters of someone's name, but let's not visit that rabbit hole).
  2. Even if it was case sensitive, %MP% would match people with MPhil degrees.
  3. The puts statement being outside of the if statement caused some confusion - it would log things as updated that matched the query, but not the ruby gsub, even though they hadn't been updated.

I considered making the MySQL query stricter, but then we might actually miss things (like someone with MP in their letters, but separated with a comma, or lower case). Instead, I've just made it clear which ones are being skipped in the logs.

While writing tests for this, I also noticed an edge case where it would replace letters like "CBE MP VC" with "CBEVC" (i.e. it would remove both surrounding spaces from MP). Better to do it with split / join to avoid this I think.

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

There were a few edge cases which came up when I ran this task last night:

1) MySQL LIKE statements are case insensitive, so the query found things like "Francis Implementation Team" (as it's got a lower case mp in).
2) Even if it was case sensitive, %MP% would match people with MPhil degrees.
3) The `puts` statement being outside of the if statement caused some confusion - it would log things as updated that matched the query, but not the ruby gsub, even though they hadn't been updated.

I considered making the MySQL query stricter, but then we might actually miss things (like someone with MP in their letters, but separated with a comma, or lower case). Instead, I've just made it clear which ones are being skipped in the logs.

While writing tests for this, I also noticed an edge case where it would replace letters like "CBE MP VC" with "CBEVC" (i.e. it would remove both surrounding spaces from MP). Better to do it with split / join to avoid this I think.
@richardTowers richardTowers force-pushed the update-remove-mp-letters-task branch from 0568dce to ba5c9d2 Compare May 30, 2024 10:13
Copy link
Contributor

@MahmudH MahmudH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM 👍🏽

@richardTowers richardTowers merged commit cfc3a7b into main May 30, 2024
19 checks passed
@richardTowers richardTowers deleted the update-remove-mp-letters-task branch May 30, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants