Spaces:
Running
Running
Update models.py
Browse files
models.py
CHANGED
|
@@ -785,7 +785,7 @@ def profile_added_db(first_name, last_name, organisation, industry, bio):
|
|
| 785 |
connection = get_db_connection()
|
| 786 |
if connection:
|
| 787 |
try:
|
| 788 |
-
cursor = connection.cursor(
|
| 789 |
user_id_creator = get_jwt_identity()
|
| 790 |
logging.info(f"Authenticated user ID: {user_id_creator}")
|
| 791 |
|
|
@@ -826,7 +826,7 @@ def view_profile_db():
|
|
| 826 |
logging.info(f"Authenticated user ID: {user_id_creator}")
|
| 827 |
connection = get_db_connection()
|
| 828 |
if connection:
|
| 829 |
-
cursor = connection.cursor(
|
| 830 |
|
| 831 |
query_check_user = "SELECT COUNT(*) AS user_count FROM users WHERE id = %s"
|
| 832 |
cursor.execute(query_check_user, (user_id_creator,))
|
|
@@ -875,7 +875,7 @@ def view_quiz_score_db(user_id, theme_table, theme, quiz_id):
|
|
| 875 |
try:
|
| 876 |
connection = get_db_connection()
|
| 877 |
if connection:
|
| 878 |
-
cursor = connection.cursor(
|
| 879 |
|
| 880 |
|
| 881 |
query = f"""
|
|
@@ -1028,7 +1028,7 @@ def get_quiz_details_db(user_id, quiz_id):
|
|
| 1028 |
if not connection:
|
| 1029 |
return {"error": "Database connection failed."}
|
| 1030 |
|
| 1031 |
-
cursor = connection.cursor(
|
| 1032 |
logging.info(f"Checking for user_id_attempt: {user_id}, quiz_id: {quiz_id}")
|
| 1033 |
cursor.execute("""
|
| 1034 |
SELECT qr.quiz_id, qr.theme, qr.user_response, qr.score, qr.time_taken, qr.submitted_on,
|
|
|
|
| 785 |
connection = get_db_connection()
|
| 786 |
if connection:
|
| 787 |
try:
|
| 788 |
+
cursor = connection.cursor()
|
| 789 |
user_id_creator = get_jwt_identity()
|
| 790 |
logging.info(f"Authenticated user ID: {user_id_creator}")
|
| 791 |
|
|
|
|
| 826 |
logging.info(f"Authenticated user ID: {user_id_creator}")
|
| 827 |
connection = get_db_connection()
|
| 828 |
if connection:
|
| 829 |
+
cursor = connection.cursor()
|
| 830 |
|
| 831 |
query_check_user = "SELECT COUNT(*) AS user_count FROM users WHERE id = %s"
|
| 832 |
cursor.execute(query_check_user, (user_id_creator,))
|
|
|
|
| 875 |
try:
|
| 876 |
connection = get_db_connection()
|
| 877 |
if connection:
|
| 878 |
+
cursor = connection.cursor()
|
| 879 |
|
| 880 |
|
| 881 |
query = f"""
|
|
|
|
| 1028 |
if not connection:
|
| 1029 |
return {"error": "Database connection failed."}
|
| 1030 |
|
| 1031 |
+
cursor = connection.cursor()
|
| 1032 |
logging.info(f"Checking for user_id_attempt: {user_id}, quiz_id: {quiz_id}")
|
| 1033 |
cursor.execute("""
|
| 1034 |
SELECT qr.quiz_id, qr.theme, qr.user_response, qr.score, qr.time_taken, qr.submitted_on,
|