Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1638,6 +1638,10 @@ def parse_csv_data(data):
|
|
| 1638 |
parsed_data.append(dict(zip(headers, row)))
|
| 1639 |
return parsed_data
|
| 1640 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1641 |
def insert_data(data, verify_phone, add_curator):
|
| 1642 |
global current_curator_index
|
| 1643 |
conn = sqlite3.connect(DATABASE2)
|
|
@@ -1649,6 +1653,9 @@ def insert_data(data, verify_phone, add_curator):
|
|
| 1649 |
email = row.get('Email', '')
|
| 1650 |
data_t = row.get('Date', '').strip('"')
|
| 1651 |
|
|
|
|
|
|
|
|
|
|
| 1652 |
cursor.execute("SELECT 1 FROM contacts WHERE email = ? OR phone = ?", (email, phone))
|
| 1653 |
user_exists = cursor.fetchone()
|
| 1654 |
|
|
|
|
| 1638 |
parsed_data.append(dict(zip(headers, row)))
|
| 1639 |
return parsed_data
|
| 1640 |
|
| 1641 |
+
def clean_phone_number(phone_number):
|
| 1642 |
+
# Удаляем все символы, кроме цифр
|
| 1643 |
+
return re.sub(r'\D', '', phone_number)
|
| 1644 |
+
|
| 1645 |
def insert_data(data, verify_phone, add_curator):
|
| 1646 |
global current_curator_index
|
| 1647 |
conn = sqlite3.connect(DATABASE2)
|
|
|
|
| 1653 |
email = row.get('Email', '')
|
| 1654 |
data_t = row.get('Date', '').strip('"')
|
| 1655 |
|
| 1656 |
+
# Очистка номера телефона
|
| 1657 |
+
phone = clean_phone_number(phone)
|
| 1658 |
+
|
| 1659 |
cursor.execute("SELECT 1 FROM contacts WHERE email = ? OR phone = ?", (email, phone))
|
| 1660 |
user_exists = cursor.fetchone()
|
| 1661 |
|