Update teacher_panel.py
Browse files- teacher_panel.py +13 -4
teacher_panel.py
CHANGED
|
@@ -10,8 +10,10 @@ from loader import (
|
|
| 10 |
save_manual_qa_file,
|
| 11 |
rebuild_combined_qa,
|
| 12 |
manual_qa_table_data,
|
| 13 |
-
sync_upload_manual_qa,
|
| 14 |
)
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def _table() -> List[List[str]]:
|
|
@@ -54,13 +56,20 @@ def teacher_save_add_overwrite(
|
|
| 54 |
save_manual_qa_file()
|
| 55 |
rebuild_combined_qa()
|
| 56 |
|
| 57 |
-
#
|
| 58 |
cloud_status = sync_upload_manual_qa()
|
| 59 |
final_msg = f"{local_msg} ({cloud_status})"
|
| 60 |
|
| 61 |
return question, answer, current_id, _table(), final_msg
|
| 62 |
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
def teacher_update_current(
|
| 65 |
question: str, answer: str, current_id: str
|
| 66 |
) -> Tuple[str, str, str, List[List[str]], str]:
|
|
@@ -93,7 +102,7 @@ def teacher_update_current(
|
|
| 93 |
save_manual_qa_file()
|
| 94 |
rebuild_combined_qa()
|
| 95 |
|
| 96 |
-
#
|
| 97 |
cloud_status = sync_upload_manual_qa()
|
| 98 |
final_msg = f"✅ ແກ້ໄຂ Q&A ສໍາເລັດ. ({cloud_status})"
|
| 99 |
|
|
@@ -120,7 +129,7 @@ def teacher_delete_current(
|
|
| 120 |
save_manual_qa_file()
|
| 121 |
rebuild_combined_qa()
|
| 122 |
|
| 123 |
-
#
|
| 124 |
cloud_status = sync_upload_manual_qa()
|
| 125 |
final_msg = f"🗑️ ລຶບ Q&A ສໍາເລັດ. ({cloud_status})"
|
| 126 |
|
|
|
|
| 10 |
save_manual_qa_file,
|
| 11 |
rebuild_combined_qa,
|
| 12 |
manual_qa_table_data,
|
| 13 |
+
sync_upload_manual_qa,
|
| 14 |
)
|
| 15 |
+
# 👇👇👇 THIS IMPORT WAS MISSING 👇👇👇
|
| 16 |
+
from model_utils import admin_force_rebuild_cache
|
| 17 |
|
| 18 |
|
| 19 |
def _table() -> List[List[str]]:
|
|
|
|
| 56 |
save_manual_qa_file()
|
| 57 |
rebuild_combined_qa()
|
| 58 |
|
| 59 |
+
# Capture the upload status and add it to the message
|
| 60 |
cloud_status = sync_upload_manual_qa()
|
| 61 |
final_msg = f"{local_msg} ({cloud_status})"
|
| 62 |
|
| 63 |
return question, answer, current_id, _table(), final_msg
|
| 64 |
|
| 65 |
|
| 66 |
+
def teacher_rebuild_cache_click():
|
| 67 |
+
"""Handler for the Rebuild Cache button"""
|
| 68 |
+
# This checks model_utils.py for the function
|
| 69 |
+
msg = admin_force_rebuild_cache()
|
| 70 |
+
return msg
|
| 71 |
+
|
| 72 |
+
|
| 73 |
def teacher_update_current(
|
| 74 |
question: str, answer: str, current_id: str
|
| 75 |
) -> Tuple[str, str, str, List[List[str]], str]:
|
|
|
|
| 102 |
save_manual_qa_file()
|
| 103 |
rebuild_combined_qa()
|
| 104 |
|
| 105 |
+
# Capture the upload status
|
| 106 |
cloud_status = sync_upload_manual_qa()
|
| 107 |
final_msg = f"✅ ແກ້ໄຂ Q&A ສໍາເລັດ. ({cloud_status})"
|
| 108 |
|
|
|
|
| 129 |
save_manual_qa_file()
|
| 130 |
rebuild_combined_qa()
|
| 131 |
|
| 132 |
+
# Capture the upload status
|
| 133 |
cloud_status = sync_upload_manual_qa()
|
| 134 |
final_msg = f"🗑️ ລຶບ Q&A ສໍາເລັດ. ({cloud_status})"
|
| 135 |
|