DmitrMakeev commited on
Commit
0e60068
·
verified ·
1 Parent(s): c1ab869

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -4
app.py CHANGED
@@ -791,7 +791,6 @@ def update_or_insert_user(db_name, user_data, mapping_template):
791
  email = user_data.get('email')
792
  logging.debug(f"Processing user with email: {email}")
793
 
794
- # Проверяем, существует ли пользователь с заданным email
795
  cursor.execute("SELECT web_st FROM contacts WHERE email = ?", (email,))
796
  user = cursor.fetchone()
797
  logging.debug(f"User found: {user}")
@@ -824,12 +823,11 @@ def update_or_insert_user(db_name, user_data, mapping_template):
824
  transformed_data['phone'] = phone
825
  logging.debug(f"Transformed data after phone processing: {transformed_data}")
826
 
827
- # Если пользователь существует, увеличиваем значение web_st на единицу
828
  if user:
829
  update_query = "UPDATE contacts SET web_st = web_st + 1 WHERE email = ?"
830
  cursor.execute(update_query, (email,))
 
831
  else:
832
- # Если пользователь не существует, вставляем новую запись с web_st равным 1
833
  columns = ', '.join(transformed_data.keys()) + ", web_st"
834
  placeholders = ', '.join('?' for _ in transformed_data) + ", ?"
835
  insert_query = f"INSERT INTO contacts ({columns}) VALUES ({placeholders})"
@@ -902,7 +900,6 @@ def send_get_request():
902
 
903
 
904
 
905
-
906
 
907
 
908
  @app.route('/biz_v', methods=['GET'])
 
791
  email = user_data.get('email')
792
  logging.debug(f"Processing user with email: {email}")
793
 
 
794
  cursor.execute("SELECT web_st FROM contacts WHERE email = ?", (email,))
795
  user = cursor.fetchone()
796
  logging.debug(f"User found: {user}")
 
823
  transformed_data['phone'] = phone
824
  logging.debug(f"Transformed data after phone processing: {transformed_data}")
825
 
 
826
  if user:
827
  update_query = "UPDATE contacts SET web_st = web_st + 1 WHERE email = ?"
828
  cursor.execute(update_query, (email,))
829
+ logging.debug(f"Incremented web_st for user with email: {email}")
830
  else:
 
831
  columns = ', '.join(transformed_data.keys()) + ", web_st"
832
  placeholders = ', '.join('?' for _ in transformed_data) + ", ?"
833
  insert_query = f"INSERT INTO contacts ({columns}) VALUES ({placeholders})"
 
900
 
901
 
902
 
 
903
 
904
 
905
  @app.route('/biz_v', methods=['GET'])