DmitrMakeev
commited on
Commit
•
9f33b0b
1
Parent(s):
1176ca5
Update app.py
Browse files
app.py
CHANGED
@@ -735,8 +735,7 @@ def send_to_google_forms(user_data, gog_url):
|
|
735 |
logging.error(f"Failed to send data to Google Forms for user: {user_data.get('email')}. Response: {response.text}")
|
736 |
|
737 |
|
738 |
-
|
739 |
-
import logging
|
740 |
|
741 |
def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
|
742 |
conn = sqlite3.connect(db_name)
|
@@ -782,6 +781,7 @@ def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
|
|
782 |
transformed_data[field] = ""
|
783 |
logging.debug(f"Transformed data after adding required fields: {transformed_data}")
|
784 |
|
|
|
785 |
if 'phone' in user_data:
|
786 |
phone = user_data['phone']
|
787 |
if phone.startswith('+'):
|
@@ -789,11 +789,20 @@ def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
|
|
789 |
transformed_data['phone'] = phone
|
790 |
logging.debug(f"Transformed data after phone processing: {transformed_data}")
|
791 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
792 |
# Проверяем наличие ws_st в базе данных и не перезаписываем его, если оно уже существует
|
793 |
if current_ws_st is not None and current_ws_st != "":
|
794 |
transformed_data['ws_st'] = current_ws_st
|
795 |
else:
|
796 |
-
transformed_data['ws_st'] =
|
797 |
|
798 |
# Увеличиваем значение web_st на 1, если пользователь уже существует в базе данных
|
799 |
if current_web_st is not None and current_web_st != "":
|
|
|
735 |
logging.error(f"Failed to send data to Google Forms for user: {user_data.get('email')}. Response: {response.text}")
|
736 |
|
737 |
|
738 |
+
|
|
|
739 |
|
740 |
def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
|
741 |
conn = sqlite3.connect(db_name)
|
|
|
781 |
transformed_data[field] = ""
|
782 |
logging.debug(f"Transformed data after adding required fields: {transformed_data}")
|
783 |
|
784 |
+
# Обработка номера телефона
|
785 |
if 'phone' in user_data:
|
786 |
phone = user_data['phone']
|
787 |
if phone.startswith('+'):
|
|
|
789 |
transformed_data['phone'] = phone
|
790 |
logging.debug(f"Transformed data after phone processing: {transformed_data}")
|
791 |
|
792 |
+
# Обработка статуса WhatsApp
|
793 |
+
new_ws_st = user_data.get('ws_st', "").strip().upper()
|
794 |
+
if new_ws_st == 'TRUE':
|
795 |
+
new_ws_st = '1'
|
796 |
+
elif new_ws_st == 'FALSE':
|
797 |
+
new_ws_st = '0'
|
798 |
+
else:
|
799 |
+
new_ws_st = ""
|
800 |
+
|
801 |
# Проверяем наличие ws_st в базе данных и не перезаписываем его, если оно уже существует
|
802 |
if current_ws_st is not None and current_ws_st != "":
|
803 |
transformed_data['ws_st'] = current_ws_st
|
804 |
else:
|
805 |
+
transformed_data['ws_st'] = new_ws_st
|
806 |
|
807 |
# Увеличиваем значение web_st на 1, если пользователь уже существует в базе данных
|
808 |
if current_web_st is not None and current_web_st != "":
|