Skip to content

Commit

Permalink
Optimise the WhatsApp Notification
Browse files Browse the repository at this point in the history
  • Loading branch information
chechani authored Jul 22, 2024
1 parent 99341b6 commit c69a1f6
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Notification."""

import json
import re
import frappe
from frappe.model.document import Document
from frappe.utils.safe_exec import get_safe_globals, safe_exec
Expand Down Expand Up @@ -237,9 +238,13 @@ def after_insert(self):

job.insert()

def format_number(self, number):
"""Format number."""
if (number.startswith("+")):
number = number[1:len(number)]
def format_number(number):
"""Format number by removing any special characters."""
# Remove the leading '+' if present
if number.startswith("+"):
number = number[1:]

return number
# Remove any special characters
number = re.sub(r"\D", "", number)

return number

0 comments on commit c69a1f6

Please sign in to comment.