raj-tomar001 commited on
Commit
46e737c
·
verified ·
1 Parent(s): ee7fb19

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +8 -11
models.py CHANGED
@@ -813,10 +813,9 @@ def profile_added_db(first_name, last_name, organisation, industry, bio):
813
  logging.error(f"Unexpected error: {e}")
814
  return jsonify({"error":"Failed to update profile"}), 500
815
  finally:
816
- if connection.is_connected():
817
- cursor.close()
818
- connection.close()
819
- logging.info("Database connection closed.")
820
 
821
 
822
  def view_profile_db():
@@ -864,10 +863,9 @@ def view_profile_db():
864
  logging.error(f"Unexpected error: {e}")
865
  return jsonify({"error": f"Unexpected error: {str(e)}"}), 500
866
  finally:
867
- if connection.is_connected():
868
- cursor.close()
869
- connection.close()
870
- logging.info("Database connection closed.")
871
 
872
 
873
 
@@ -929,9 +927,8 @@ def view_quiz_score_db(user_id, theme_table, theme, quiz_id):
929
  return jsonify({"error": "Unable to fetch quiz score"}), 500
930
 
931
  finally:
932
- if connection.is_connected():
933
- cursor.close()
934
- connection.close()
935
 
936
 
937
 
 
813
  logging.error(f"Unexpected error: {e}")
814
  return jsonify({"error":"Failed to update profile"}), 500
815
  finally:
816
+ cursor.close()
817
+ connection.close()
818
+ logging.info("Database connection closed.")
 
819
 
820
 
821
  def view_profile_db():
 
863
  logging.error(f"Unexpected error: {e}")
864
  return jsonify({"error": f"Unexpected error: {str(e)}"}), 500
865
  finally:
866
+ cursor.close()
867
+ connection.close()
868
+ logging.info("Database connection closed.")
 
869
 
870
 
871
 
 
927
  return jsonify({"error": "Unable to fetch quiz score"}), 500
928
 
929
  finally:
930
+ cursor.close()
931
+ connection.close()
 
932
 
933
 
934