Spaces:
Running
Running
Upload 10 files
Browse files- src/views/InstructorView.js +34 -38
src/views/InstructorView.js
CHANGED
|
@@ -627,49 +627,45 @@ export function setupInstructorEvents() {
|
|
| 627 |
}
|
| 628 |
};
|
| 629 |
|
| 630 |
-
/*
|
| 631 |
-
// Bind Reject Button Logic (Delegated)
|
| 632 |
-
if (!window._rejectListenerAttached) {
|
| 633 |
-
window._rejectListenerAttached = true;
|
| 634 |
-
document.body.addEventListener('click', async (e) => {
|
| 635 |
-
const btnReject = e.target.closest('#btn-reject-task');
|
| 636 |
-
if (btnReject) {
|
| 637 |
-
console.log("Reject button clicked (Delegated Event)");
|
| 638 |
-
const modal = document.getElementById('broadcast-modal');
|
| 639 |
-
if (!modal) return;
|
| 640 |
-
|
| 641 |
-
const userId = modal.dataset.userId;
|
| 642 |
-
const challengeId = modal.dataset.challengeId;
|
| 643 |
-
const roomCode = localStorage.getItem('vibecoding_room_code');
|
| 644 |
-
|
| 645 |
-
console.log('Reject attempt - Click details:', { dataset: modal.dataset, userId, challengeId, roomCode });
|
| 646 |
-
|
| 647 |
-
if (!userId || !challengeId) {
|
| 648 |
-
console.error('Missing userId or challengeId');
|
| 649 |
-
alert("錯誤:無法讀取學員資訊 (Missing ID)");
|
| 650 |
-
return;
|
| 651 |
-
}
|
| 652 |
|
| 653 |
-
if (confirm('確定要退回此學員的進度嗎?學員將需要重新作答。')) {
|
| 654 |
-
try {
|
| 655 |
-
const { resetProgress } = await import("../services/classroom.js");
|
| 656 |
-
const success = await resetProgress(userId, roomCode, challengeId);
|
| 657 |
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 668 |
}
|
|
|
|
|
|
|
|
|
|
| 669 |
}
|
| 670 |
-
}
|
| 671 |
}
|
| 672 |
-
|
|
|
|
| 673 |
|
| 674 |
let roomUnsubscribe = null;
|
| 675 |
let currentInstructor = null;
|
|
|
|
| 627 |
}
|
| 628 |
};
|
| 629 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 630 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
|
| 632 |
+
const btnReject = null; // Logic disabled
|
| 633 |
+
if (btnReject) {
|
| 634 |
+
console.log("Reject button clicked (Delegated Event)");
|
| 635 |
+
const modal = document.getElementById('broadcast-modal');
|
| 636 |
+
if (!modal) return;
|
| 637 |
+
|
| 638 |
+
const userId = modal.dataset.userId;
|
| 639 |
+
const challengeId = modal.dataset.challengeId;
|
| 640 |
+
const roomCode = localStorage.getItem('vibecoding_room_code');
|
| 641 |
+
|
| 642 |
+
console.log('Reject attempt - Click details:', { dataset: modal.dataset, userId, challengeId, roomCode });
|
| 643 |
+
|
| 644 |
+
if (!userId || !challengeId) {
|
| 645 |
+
console.error('Missing userId or challengeId');
|
| 646 |
+
alert("錯誤:無法讀取學員資訊 (Missing ID)");
|
| 647 |
+
return;
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
if (confirm('確定要退回此學員的進度嗎?學員將需要重新作答。')) {
|
| 651 |
+
try {
|
| 652 |
+
const { resetProgress } = import("../services/classroom.js"); // await removed;
|
| 653 |
+
const success = resetProgress(userId, roomCode, challengeId); // await removed;
|
| 654 |
+
|
| 655 |
+
if (success) {
|
| 656 |
+
alert('已成功退回,學員將需要重新作答。');
|
| 657 |
+
window.closeBroadcastModal();
|
| 658 |
+
} else {
|
| 659 |
+
alert('找不到該學員的進度紀錄,無法退回 (Document Not Found)。');
|
| 660 |
}
|
| 661 |
+
} catch (e) {
|
| 662 |
+
console.error("Reject failed:", e);
|
| 663 |
+
alert('退回失敗: ' + e.message);
|
| 664 |
}
|
| 665 |
+
}
|
| 666 |
}
|
| 667 |
+
|
| 668 |
+
|
| 669 |
|
| 670 |
let roomUnsubscribe = null;
|
| 671 |
let currentInstructor = null;
|