DmitrMakeev commited on
Commit
1a36f68
·
verified ·
1 Parent(s): c469556

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -3
app.py CHANGED
@@ -1190,14 +1190,38 @@ def insert_data(data):
1190
  msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
1191
  data_t = msk_now.strftime('%Y-%m-%d %H:%M:%S')
1192
 
1193
- # Проверка наличия ключей перед их использованием
1194
  name = row.get('name', '')
1195
  phone = row.get('phone', '')
1196
  email = row.get('email', '')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1197
 
1198
  # Создание динамического SQL-запроса
1199
- columns = ['name', 'phone', 'email', 'data_t']
1200
- values = [name, phone, email, data_t]
1201
 
1202
  placeholders = ', '.join(['?' for _ in columns])
1203
  columns_str = ', '.join(columns)
 
1190
  msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
1191
  data_t = msk_now.strftime('%Y-%m-%d %H:%M:%S')
1192
 
1193
+ # Проверка наличия ключей перед их использованием и предоставление значений по умолчанию
1194
  name = row.get('name', '')
1195
  phone = row.get('phone', '')
1196
  email = row.get('email', '')
1197
+ vk_id = row.get('vk_id', '')
1198
+ chat_id = row.get('chat_id', '')
1199
+ ws_st = row.get('ws_st', '')
1200
+ ws_stop = row.get('ws_stop', '')
1201
+ web_st = row.get('web_st', 0)
1202
+ fin_prog = row.get('fin_prog', 0)
1203
+ b_city = row.get('b_city', '')
1204
+ b_fin = row.get('b_fin', '')
1205
+ b_ban = row.get('b_ban', '')
1206
+ b_ign = row.get('b_ign', '')
1207
+ b_baners = row.get('b_baners', '')
1208
+ b_butt = row.get('b_butt', '')
1209
+ b_mess = row.get('b_mess', '')
1210
+ shop_st = row.get('shop_st', '')
1211
+ curator = row.get('curator', '')
1212
+ pr1 = row.get('pr1', '')
1213
+ pr2 = row.get('pr2', '')
1214
+ pr3 = row.get('pr3', '')
1215
+ pr4 = row.get('pr4', '')
1216
+ pr5 = row.get('pr5', '')
1217
+ ad_url = row.get('ad_url', '')
1218
+ key_pr = row.get('key_pr', '')
1219
+ n_con = row.get('n_con', '')
1220
+ canal = row.get('canal', '')
1221
 
1222
  # Создание динамического SQL-запроса
1223
+ 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', 'shop_st', 'curator', 'pr1', 'pr2', 'pr3', 'pr4', 'pr5', 'ad_url', 'key_pr', 'n_con', 'canal', 'data_t']
1224
+ values = [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, shop_st, curator, pr1, pr2, pr3, pr4, pr5, ad_url, key_pr, n_con, canal, data_t]
1225
 
1226
  placeholders = ', '.join(['?' for _ in columns])
1227
  columns_str = ', '.join(columns)