DmitrMakeev
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ def init_db(db_name):
|
|
118 |
shop_status TEXT,
|
119 |
answers TEXT,
|
120 |
quiz TEXT,
|
121 |
-
|
122 |
gc_url TEXT,
|
123 |
key_pr TEXT,
|
124 |
n_con TEXT,
|
@@ -388,7 +388,7 @@ def add_or_update_contact(contact_data, db_name):
|
|
388 |
fields = [
|
389 |
'name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog',
|
390 |
'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator',
|
391 |
-
'bonus', 'shop_status', 'answers', 'quiz', '
|
392 |
]
|
393 |
|
394 |
for field in fields:
|
@@ -1057,7 +1057,7 @@ def data_gc_tab_out():
|
|
1057 |
cursor.execute('''
|
1058 |
SELECT id, name, phone, email, vk_id, chat_id, ws_st, ws_stop, web_st, fin_prog,
|
1059 |
b_city, b_fin, b_ban, b_ign, b_baners, b_butt, b_mess, orders, curator,
|
1060 |
-
bonus, shop_status, answers, quiz,
|
1061 |
FROM contacts
|
1062 |
''')
|
1063 |
contacts = cursor.fetchall()
|
@@ -1069,7 +1069,7 @@ def data_gc_tab_out():
|
|
1069 |
'web_st': contact[8], 'fin_prog': contact[9], 'b_city': contact[10], 'b_fin': contact[11],
|
1070 |
'b_ban': contact[12], 'b_ign': contact[13], 'b_baners': contact[14], 'b_butt': contact[15],
|
1071 |
'b_mess': contact[16], 'orders': contact[17], 'curator': contact[18], 'bonus': contact[19],
|
1072 |
-
'shop_status': contact[20], 'answers': contact[21], 'quiz': contact[22], '
|
1073 |
'gc_url': contact[24], 'key_pr': contact[25], 'n_con': contact[26], 'canal': contact[27],'data_on': contact[28],
|
1074 |
'data_t': contact[29],'utm_source': contact[30], 'utm_medium': contact[31], 'utm_campaign': contact[32],
|
1075 |
'utm_term': contact[33], 'utm_content': contact[34], 'gcpc': contact[34]
|
@@ -1143,8 +1143,8 @@ def insert_data(data, verify_phone, add_curator):
|
|
1143 |
else:
|
1144 |
ws_st = row.get('ws_st', '')
|
1145 |
|
1146 |
-
columns = ['name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog', 'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator', 'bonus', 'shop_status', 'answers', 'quiz', '
|
1147 |
-
values = [name, phone, email, row.get('vk_id', ''), row.get('chat_id', ''), ws_st, row.get('ws_stop', ''), row.get('web_st', 0), row.get('fin_prog', 0), row.get('b_city', ''), row.get('b_fin', ''), row.get('b_ban', ''), row.get('b_ign', ''), row.get('b_baners', ''), row.get('b_butt', ''), row.get('b_mess', ''), row.get('orders', ''), curator, row.get('bonus', ''), row.get('shop_status', ''), row.get('answers', ''), row.get('quiz', ''), row.get('
|
1148 |
|
1149 |
placeholders = ', '.join(['?' for _ in columns])
|
1150 |
columns_str = ', '.join(columns)
|
@@ -1221,8 +1221,8 @@ def insert_data_j(data):
|
|
1221 |
print(f"User with email {email} or phone {phone} already exists. Skipping insert.")
|
1222 |
continue
|
1223 |
|
1224 |
-
columns = ['name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog', 'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator', 'bonus', 'shop_status', 'answers', 'quiz', '
|
1225 |
-
values = [name, phone, email, row.get('vk_id', ''), row.get('chat_id', ''), row.get('ws_st', ''), row.get('ws_stop', ''), row.get('web_st', 0), row.get('fin_prog', 0), row.get('b_city', ''), row.get('b_fin', ''), row.get('b_ban', ''), row.get('b_ign', ''), row.get('b_baners', ''), row.get('b_butt', ''), row.get('b_mess', ''), row.get('orders', ''), row.get('curator', ''), row.get('bonus', ''), row.get('shop_status', ''), row.get('answers', ''), row.get('quiz', ''), row.get('
|
1226 |
|
1227 |
placeholders = ', '.join(['?' for _ in columns])
|
1228 |
columns_str = ', '.join(columns)
|
@@ -1327,7 +1327,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
|
|
1327 |
required_fields = [
|
1328 |
"vk_id", "chat_id", "ws_st", "ws_stop", "web_st", "fin_prog",
|
1329 |
"b_city", "b_fin", "b_ban", "b_ign", "b_baners", "b_butt", "b_mess",
|
1330 |
-
"orders", "curator", "bonus", "shop_status", "answers", "quiz", "
|
1331 |
"key_pr", "n_con", "canal", "data_on", "data_t", 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
|
1332 |
]
|
1333 |
|
|
|
118 |
shop_status TEXT,
|
119 |
answers TEXT,
|
120 |
quiz TEXT,
|
121 |
+
kassa TEXT,
|
122 |
gc_url TEXT,
|
123 |
key_pr TEXT,
|
124 |
n_con TEXT,
|
|
|
388 |
fields = [
|
389 |
'name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog',
|
390 |
'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator',
|
391 |
+
'bonus', 'shop_status', 'answers', 'quiz', 'kassa', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
|
392 |
]
|
393 |
|
394 |
for field in fields:
|
|
|
1057 |
cursor.execute('''
|
1058 |
SELECT id, name, phone, email, vk_id, chat_id, ws_st, ws_stop, web_st, fin_prog,
|
1059 |
b_city, b_fin, b_ban, b_ign, b_baners, b_butt, b_mess, orders, curator,
|
1060 |
+
bonus, shop_status, answers, quiz, kassa, gc_url, key_pr, n_con, canal, data_on, data_t, utm_source, utm_medium, utm_campaign, utm_term, utm_content, gcpc
|
1061 |
FROM contacts
|
1062 |
''')
|
1063 |
contacts = cursor.fetchall()
|
|
|
1069 |
'web_st': contact[8], 'fin_prog': contact[9], 'b_city': contact[10], 'b_fin': contact[11],
|
1070 |
'b_ban': contact[12], 'b_ign': contact[13], 'b_baners': contact[14], 'b_butt': contact[15],
|
1071 |
'b_mess': contact[16], 'orders': contact[17], 'curator': contact[18], 'bonus': contact[19],
|
1072 |
+
'shop_status': contact[20], 'answers': contact[21], 'quiz': contact[22], 'kassa': contact[23],
|
1073 |
'gc_url': contact[24], 'key_pr': contact[25], 'n_con': contact[26], 'canal': contact[27],'data_on': contact[28],
|
1074 |
'data_t': contact[29],'utm_source': contact[30], 'utm_medium': contact[31], 'utm_campaign': contact[32],
|
1075 |
'utm_term': contact[33], 'utm_content': contact[34], 'gcpc': contact[34]
|
|
|
1143 |
else:
|
1144 |
ws_st = row.get('ws_st', '')
|
1145 |
|
1146 |
+
columns = ['name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog', 'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator', 'bonus', 'shop_status', 'answers', 'quiz', 'kassa', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc']
|
1147 |
+
values = [name, phone, email, row.get('vk_id', ''), row.get('chat_id', ''), ws_st, row.get('ws_stop', ''), row.get('web_st', 0), row.get('fin_prog', 0), row.get('b_city', ''), row.get('b_fin', ''), row.get('b_ban', ''), row.get('b_ign', ''), row.get('b_baners', ''), row.get('b_butt', ''), row.get('b_mess', ''), row.get('orders', ''), curator, row.get('bonus', ''), row.get('shop_status', ''), row.get('answers', ''), row.get('quiz', ''), row.get('kassa', ''), row.get('gc_url', ''), row.get('key_pr', ''), row.get('n_con', ''), row.get('canal', ''), row.get('data_on', ''), row.get('data_t', ''), row.get('utm_source', ''), row.get('utm_medium', ''), row.get('utm_campaign', ''), row.get('utm_term', ''), row.get('utm_content', ''), row.get('gcpc', '')]
|
1148 |
|
1149 |
placeholders = ', '.join(['?' for _ in columns])
|
1150 |
columns_str = ', '.join(columns)
|
|
|
1221 |
print(f"User with email {email} or phone {phone} already exists. Skipping insert.")
|
1222 |
continue
|
1223 |
|
1224 |
+
columns = ['name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog', 'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator', 'bonus', 'shop_status', 'answers', 'quiz', 'kassa', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc']
|
1225 |
+
values = [name, phone, email, row.get('vk_id', ''), row.get('chat_id', ''), row.get('ws_st', ''), row.get('ws_stop', ''), row.get('web_st', 0), row.get('fin_prog', 0), row.get('b_city', ''), row.get('b_fin', ''), row.get('b_ban', ''), row.get('b_ign', ''), row.get('b_baners', ''), row.get('b_butt', ''), row.get('b_mess', ''), row.get('orders', ''), row.get('curator', ''), row.get('bonus', ''), row.get('shop_status', ''), row.get('answers', ''), row.get('quiz', ''), row.get('kassa', ''), row.get('gc_url', ''), row.get('key_pr', ''), row.get('n_con', ''), row.get('canal', ''), row.get('data_on', ''), row.get('data_t', ''), row.get('utm_source', ''), row.get('utm_medium', ''), row.get('utm_campaign', ''), row.get('utm_term', ''), row.get('utm_content', ''), row.get('gcpc', '')]
|
1226 |
|
1227 |
placeholders = ', '.join(['?' for _ in columns])
|
1228 |
columns_str = ', '.join(columns)
|
|
|
1327 |
required_fields = [
|
1328 |
"vk_id", "chat_id", "ws_st", "ws_stop", "web_st", "fin_prog",
|
1329 |
"b_city", "b_fin", "b_ban", "b_ign", "b_baners", "b_butt", "b_mess",
|
1330 |
+
"orders", "curator", "bonus", "shop_status", "answers", "quiz", "kassa", "gc_url",
|
1331 |
"key_pr", "n_con", "canal", "data_on", "data_t", 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
|
1332 |
]
|
1333 |
|