Spaces:
Runtime error
Runtime error
specify DB
Browse files
app.py
CHANGED
|
@@ -83,19 +83,19 @@ def save_data(orig_user_email, constituent_email, labels, user_response):
|
|
| 83 |
try:
|
| 84 |
print("saving first email")
|
| 85 |
db_cursor.execute(
|
| 86 |
-
"INSERT INTO messages (app_id, org_id, person_id, communication_method_id, status_id, subject, body, send_date, message_type, volley) VALUES (0, 0, 0, 1, 1, 'Email Classification and Response Tracking', %s, NOW(), 'Email Classification and Response Tracking', 0)",
|
| 87 |
(orig_user_email,),
|
| 88 |
)
|
| 89 |
|
| 90 |
print("saving constituent email")
|
| 91 |
db_cursor.execute(
|
| 92 |
-
"INSERT INTO messages (app_id, org_id, person_id, communication_method_id, status_id, subject, body, send_date, message_type, volley) VALUES (0, 0, 0, 1, 1, 'Email Classification and Response Tracking', %s, NOW(), 'Email Classification and Response Tracking', 1)",
|
| 93 |
(constituent_email,),
|
| 94 |
)
|
| 95 |
|
| 96 |
print("saving user response")
|
| 97 |
db_cursor.execute(
|
| 98 |
-
"INSERT INTO messages (app_id, org_id, person_id, communication_method_id, status_id, subject, body, send_date, message_type, volley) VALUES (0, 0, 0, 1, 1, 'Email Classification and Response Tracking', %s, NOW(), 'Email Classification and Response Tracking', 2)",
|
| 99 |
(user_response,),
|
| 100 |
)
|
| 101 |
|
|
@@ -111,7 +111,7 @@ def save_data(orig_user_email, constituent_email, labels, user_response):
|
|
| 111 |
if label_exists:
|
| 112 |
print("label exists")
|
| 113 |
db_cursor.execute(
|
| 114 |
-
"INSERT INTO message_category_associations (message_id, message_category_id) VALUES ((SELECT id FROM messages WHERE body = %s), %i)",
|
| 115 |
(constituent_email, label_exists[0][0]),
|
| 116 |
)
|
| 117 |
print("label saved")
|
|
|
|
| 83 |
try:
|
| 84 |
print("saving first email")
|
| 85 |
db_cursor.execute(
|
| 86 |
+
"INSERT INTO radmap_frog12.messages (app_id, org_id, person_id, communication_method_id, status_id, subject, body, send_date, message_type, volley) VALUES (0, 0, 0, 1, 1, 'Email Classification and Response Tracking', %s, NOW(), 'Email Classification and Response Tracking', 0)",
|
| 87 |
(orig_user_email,),
|
| 88 |
)
|
| 89 |
|
| 90 |
print("saving constituent email")
|
| 91 |
db_cursor.execute(
|
| 92 |
+
"INSERT INTO radmap_frog12.messages (app_id, org_id, person_id, communication_method_id, status_id, subject, body, send_date, message_type, volley) VALUES (0, 0, 0, 1, 1, 'Email Classification and Response Tracking', %s, NOW(), 'Email Classification and Response Tracking', 1)",
|
| 93 |
(constituent_email,),
|
| 94 |
)
|
| 95 |
|
| 96 |
print("saving user response")
|
| 97 |
db_cursor.execute(
|
| 98 |
+
"INSERT INTO radmap_frog12.messages (app_id, org_id, person_id, communication_method_id, status_id, subject, body, send_date, message_type, volley) VALUES (0, 0, 0, 1, 1, 'Email Classification and Response Tracking', %s, NOW(), 'Email Classification and Response Tracking', 2)",
|
| 99 |
(user_response,),
|
| 100 |
)
|
| 101 |
|
|
|
|
| 111 |
if label_exists:
|
| 112 |
print("label exists")
|
| 113 |
db_cursor.execute(
|
| 114 |
+
"INSERT INTO radmap_frog12.message_category_associations (message_id, message_category_id) VALUES ((SELECT id FROM messages WHERE body = %s), %i)",
|
| 115 |
(constituent_email, label_exists[0][0]),
|
| 116 |
)
|
| 117 |
print("label saved")
|