Spaces:
Running
Running
Upload 9 files
Browse files
src/views/InstructorView.js
CHANGED
|
@@ -486,7 +486,9 @@ export function setupInstructorEvents() {
|
|
| 486 |
const heatmapBody = document.getElementById('heatmap-body');
|
| 487 |
const heatmapHeader = document.getElementById('heatmap-header');
|
| 488 |
|
| 489 |
-
|
|
|
|
|
|
|
| 490 |
heatmapBody.innerHTML = '<tr><td colspan="100" class="text-center py-10 text-gray-500">尚無學員加入</td></tr>';
|
| 491 |
return;
|
| 492 |
}
|
|
@@ -497,7 +499,7 @@ export function setupInstructorEvents() {
|
|
| 497 |
|
| 498 |
// This part needs real logic based on your data structure
|
| 499 |
// For now, let's just list users to prove it works
|
| 500 |
-
|
| 501 |
const tr = document.createElement('tr');
|
| 502 |
tr.innerHTML = `<td class="p-3 text-white">${user.nickname || 'Unknown'}</td>`;
|
| 503 |
heatmapBody.appendChild(tr);
|
|
|
|
| 486 |
const heatmapBody = document.getElementById('heatmap-body');
|
| 487 |
const heatmapHeader = document.getElementById('heatmap-header');
|
| 488 |
|
| 489 |
+
const users = Array.isArray(data) ? data : (data?.users ? Object.values(data.users) : []);
|
| 490 |
+
|
| 491 |
+
if (users.length === 0) {
|
| 492 |
heatmapBody.innerHTML = '<tr><td colspan="100" class="text-center py-10 text-gray-500">尚無學員加入</td></tr>';
|
| 493 |
return;
|
| 494 |
}
|
|
|
|
| 499 |
|
| 500 |
// This part needs real logic based on your data structure
|
| 501 |
// For now, let's just list users to prove it works
|
| 502 |
+
users.forEach(user => {
|
| 503 |
const tr = document.createElement('tr');
|
| 504 |
tr.innerHTML = `<td class="p-3 text-white">${user.nickname || 'Unknown'}</td>`;
|
| 505 |
heatmapBody.appendChild(tr);
|