Lashtw commited on
Commit
40dc370
·
verified ·
1 Parent(s): 1a0fbde

Upload 9 files

Browse files
Files changed (1) hide show
  1. src/views/InstructorView.js +4 -2
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
- if (!data || !data.users) {
 
 
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
- Object.values(data.users).forEach(user => {
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);