AndreasWintherMoen / jobb

Bedpres Bot, a messaging bot to notify users about student events
https://bedpresbot.no/
12 stars 0 forks source link

Change format_phone_number to include double zero convention #26

Closed Kpaubert closed 1 year ago

Kpaubert commented 2 years ago

Currently, the utility function format_phone_number checks if the phone_number includes a country code. It does this by checking if the number starts with a plus sign, "+". Another way of assigning a country code is by starting the phone number with two zeroes, "00". It's not necessarily an important change, since most people use the plus convention (if any) - but it could be an idea to check if a phone number starts with "00" so the function doesn't return weird numbers.

Convention Phone number Number after format_phone_number
No convention 12345678 +4712345678
Plus +4712345678 +4712345678
Double zero 004712345678 +47004712345678
Kpaubert commented 2 years ago

@AndreasWintherMoen I'd suggest checking the database for any occurrences of other conventions than plus. If not, this issue can be closed.

AndreasWintherMoen commented 2 years ago

The reason I have that function in the first place is because Twilio requires a plus format (E.164 formatting), but most OW users don't add a country code. So the function basically just prepends +47 to those numbers, and also removes any whitespace. I don't think I've seen anyone use the 00 format in OW, but I can take a look.

bitmoji

Kpaubert commented 1 year ago

You said that you would take a look. Any updates?

Kpaubert commented 1 year ago

Closing this due to staleness and irrelevance.