DmitrMakeev commited on
Commit
f36fae6
·
verified ·
1 Parent(s): 9084383

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -102,7 +102,7 @@ def init_db(db_name):
102
  curator TEXT,
103
  bonus TEXT,
104
  shop_status TEXT,
105
- pr3 TEXT,
106
  pr4 TEXT,
107
  pr5 TEXT,
108
  gc_url TEXT,
@@ -316,7 +316,7 @@ def add_or_update_contact(contact_data, db_name):
316
  fields = [
317
  'name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog',
318
  'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator',
319
- 'bonus', 'shop_status', 'pr3', 'pr4', 'pr5', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
320
  ]
321
 
322
  for field in fields:
@@ -757,7 +757,7 @@ def data_gc_tab_out():
757
  cursor.execute('''
758
  SELECT id, name, phone, email, vk_id, chat_id, ws_st, ws_stop, web_st, fin_prog,
759
  b_city, b_fin, b_ban, b_ign, b_baners, b_butt, b_mess, orders, curator,
760
- bonus, shop_status, pr3, pr4, pr5, gc_url, key_pr, n_con, canal, data_on, data_t, utm_source, utm_medium, utm_campaign, utm_term, utm_content, gcpc
761
  FROM contacts
762
  ''')
763
  contacts = cursor.fetchall()
@@ -769,7 +769,7 @@ def data_gc_tab_out():
769
  'web_st': contact[8], 'fin_prog': contact[9], 'b_city': contact[10], 'b_fin': contact[11],
770
  'b_ban': contact[12], 'b_ign': contact[13], 'b_baners': contact[14], 'b_butt': contact[15],
771
  'b_mess': contact[16], 'orders': contact[17], 'curator': contact[18], 'bonus': contact[19],
772
- 'shop_status': contact[20], 'pr3': contact[21], 'pr4': contact[22], 'pr5': contact[23],
773
  'gc_url': contact[24], 'key_pr': contact[25], 'n_con': contact[26], 'canal': contact[27],'data_on': contact[28],
774
  'data_t': contact[29],'utm_source': contact[30], 'utm_medium': contact[31], 'utm_campaign': contact[32],
775
  'utm_term': contact[33], 'utm_content': contact[34], 'gcpc': contact[34]
@@ -843,8 +843,8 @@ def insert_data(data, verify_phone, add_curator):
843
  else:
844
  ws_st = row.get('ws_st', '')
845
 
846
- 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', 'pr3', 'pr4', 'pr5', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc']
847
- 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('pr3', ''), row.get('pr4', ''), row.get('pr5', ''), 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', '')]
848
 
849
  placeholders = ', '.join(['?' for _ in columns])
850
  columns_str = ', '.join(columns)
@@ -921,8 +921,8 @@ def insert_data_j(data):
921
  print(f"User with email {email} or phone {phone} already exists. Skipping insert.")
922
  continue
923
 
924
- 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', 'pr3', 'pr4', 'pr5', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc']
925
- 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('pr3', ''), row.get('pr4', ''), row.get('pr5', ''), 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', '')]
926
 
927
  placeholders = ', '.join(['?' for _ in columns])
928
  columns_str = ', '.join(columns)
@@ -1027,7 +1027,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
1027
  required_fields = [
1028
  "vk_id", "chat_id", "ws_st", "ws_stop", "web_st", "fin_prog",
1029
  "b_city", "b_fin", "b_ban", "b_ign", "b_baners", "b_butt", "b_mess",
1030
- "orders", "curator", "bonus", "shop_status", "pr3", "pr4", "pr5", "gc_url",
1031
  "key_pr", "n_con", "canal", "data_on", "data_t", 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
1032
  ]
1033
 
 
102
  curator TEXT,
103
  bonus TEXT,
104
  shop_status TEXT,
105
+ answers TEXT,
106
  pr4 TEXT,
107
  pr5 TEXT,
108
  gc_url TEXT,
 
316
  fields = [
317
  'name', 'phone', 'email', 'vk_id', 'chat_id', 'ws_st', 'ws_stop', 'web_st', 'fin_prog',
318
  'b_city', 'b_fin', 'b_ban', 'b_ign', 'b_baners', 'b_butt', 'b_mess', 'orders', 'curator',
319
+ 'bonus', 'shop_status', 'answers', 'pr4', 'pr5', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
320
  ]
321
 
322
  for field in fields:
 
757
  cursor.execute('''
758
  SELECT id, name, phone, email, vk_id, chat_id, ws_st, ws_stop, web_st, fin_prog,
759
  b_city, b_fin, b_ban, b_ign, b_baners, b_butt, b_mess, orders, curator,
760
+ bonus, shop_status, answers, pr4, pr5, gc_url, key_pr, n_con, canal, data_on, data_t, utm_source, utm_medium, utm_campaign, utm_term, utm_content, gcpc
761
  FROM contacts
762
  ''')
763
  contacts = cursor.fetchall()
 
769
  'web_st': contact[8], 'fin_prog': contact[9], 'b_city': contact[10], 'b_fin': contact[11],
770
  'b_ban': contact[12], 'b_ign': contact[13], 'b_baners': contact[14], 'b_butt': contact[15],
771
  'b_mess': contact[16], 'orders': contact[17], 'curator': contact[18], 'bonus': contact[19],
772
+ 'shop_status': contact[20], 'answers': contact[21], 'pr4': contact[22], 'pr5': contact[23],
773
  'gc_url': contact[24], 'key_pr': contact[25], 'n_con': contact[26], 'canal': contact[27],'data_on': contact[28],
774
  'data_t': contact[29],'utm_source': contact[30], 'utm_medium': contact[31], 'utm_campaign': contact[32],
775
  'utm_term': contact[33], 'utm_content': contact[34], 'gcpc': contact[34]
 
843
  else:
844
  ws_st = row.get('ws_st', '')
845
 
846
+ 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', 'pr4', 'pr5', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc']
847
+ 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('pr4', ''), row.get('pr5', ''), 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', '')]
848
 
849
  placeholders = ', '.join(['?' for _ in columns])
850
  columns_str = ', '.join(columns)
 
921
  print(f"User with email {email} or phone {phone} already exists. Skipping insert.")
922
  continue
923
 
924
+ 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', 'pr4', 'pr5', 'gc_url', 'key_pr', 'n_con', 'canal', 'data_on', 'data_t', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc']
925
+ 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('pr4', ''), row.get('pr5', ''), 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', '')]
926
 
927
  placeholders = ', '.join(['?' for _ in columns])
928
  columns_str = ', '.join(columns)
 
1027
  required_fields = [
1028
  "vk_id", "chat_id", "ws_st", "ws_stop", "web_st", "fin_prog",
1029
  "b_city", "b_fin", "b_ban", "b_ign", "b_baners", "b_butt", "b_mess",
1030
+ "orders", "curator", "bonus", "shop_status", "answers", "pr4", "pr5", "gc_url",
1031
  "key_pr", "n_con", "canal", "data_on", "data_t", 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gcpc'
1032
  ]
1033