DmitrMakeev commited on
Commit
50c08b5
1 Parent(s): b77105a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -786,7 +786,7 @@ def update_or_insert_user(db_name, user_data, mapping_template):
786
  for json_key, db_column in mapping_template.items():
787
  value = user_data.get(json_key, "")
788
  if isinstance(value, list):
789
- transformed_data[db_column] = "-1" if value else "0"
790
  else:
791
  transformed_data[db_column] = str(value)
792
  logging.debug(f"Transformed data: {transformed_data}")
@@ -869,7 +869,7 @@ def send_get_request():
869
  # Обновление или добавление каждого пользователя в базу данных data_gc.db
870
  for user_id, user_data in users_meta.items():
871
  user_data['messages'] = messages_json
872
- update_or_insert_user(DATABASE_NAME, user_data, template)
873
 
874
  return jsonify({'status': 'User data saved successfully'})
875
  else:
@@ -884,7 +884,6 @@ def send_get_request():
884
 
885
 
886
 
887
-
888
  @app.route('/biz_v', methods=['GET'])
889
  def biz_v():
890
  api_sys_control = request.args.get('api_sys')
 
786
  for json_key, db_column in mapping_template.items():
787
  value = user_data.get(json_key, "")
788
  if isinstance(value, list):
789
+ transformed_data[db_column] = "1" if value else "0"
790
  else:
791
  transformed_data[db_column] = str(value)
792
  logging.debug(f"Transformed data: {transformed_data}")
 
869
  # Обновление или добавление каждого пользователя в базу данных data_gc.db
870
  for user_id, user_data in users_meta.items():
871
  user_data['messages'] = messages_json
872
+ update_or_insert_user(DATABASE_NAME, user_data, mapping_template)
873
 
874
  return jsonify({'status': 'User data saved successfully'})
875
  else:
 
884
 
885
 
886
 
 
887
  @app.route('/biz_v', methods=['GET'])
888
  def biz_v():
889
  api_sys_control = request.args.get('api_sys')