DmitrMakeev commited on
Commit
2e56ab6
1 Parent(s): 77c1c48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -735,6 +735,9 @@ 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
  def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
739
  conn = sqlite3.connect(db_name)
740
  cursor = conn.cursor()
@@ -753,6 +756,7 @@ def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
753
  current_web_st = user[0] if user else None
754
  current_ws_st = user[1] if user else None
755
  current_messages = user[2] if user else ""
 
756
 
757
  transformed_data = {}
758
  for json_key, db_column in mapping_template.items():
@@ -791,11 +795,11 @@ def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
791
  else:
792
  transformed_data['ws_st'] = user_data.get('ws_st', "")
793
 
794
- # Увеличиваем значение web_st на 1, если пользователь уже существует в базе данных
795
- if current_web_st is not None and current_web_st != "":
796
- transformed_data['web_st'] = int(current_web_st) + 1
797
  else:
798
- transformed_data['web_st'] = 1
799
 
800
  new_messages = transformed_data.get('b_mess', "")
801
  if current_messages:
@@ -831,6 +835,7 @@ def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
831
 
832
 
833
 
 
834
  @app.route('/send_request', methods=['POST'])
835
  def send_request():
836
  token = request.form.get('token')
 
735
  logging.error(f"Failed to send data to Google Forms for user: {user_data.get('email')}. Response: {response.text}")
736
 
737
 
738
+ import sqlite3
739
+ import logging
740
+
741
  def update_or_insert_user(db_name, user_data, mapping_template, gog_url):
742
  conn = sqlite3.connect(db_name)
743
  cursor = conn.cursor()
 
756
  current_web_st = user[0] if user else None
757
  current_ws_st = user[1] if user else None
758
  current_messages = user[2] if user else ""
759
+ logging.debug(f"Current web_st: {current_web_st}, current_ws_st: {current_ws_st}, current_messages: {current_messages}")
760
 
761
  transformed_data = {}
762
  for json_key, db_column in mapping_template.items():
 
795
  else:
796
  transformed_data['ws_st'] = user_data.get('ws_st', "")
797
 
798
+ # Не изменяем значение web_st
799
+ if current_web_st is not None:
800
+ transformed_data['web_st'] = current_web_st
801
  else:
802
+ transformed_data['web_st'] = user_data.get('web_st', "")
803
 
804
  new_messages = transformed_data.get('b_mess', "")
805
  if current_messages:
 
835
 
836
 
837
 
838
+
839
  @app.route('/send_request', methods=['POST'])
840
  def send_request():
841
  token = request.form.get('token')