yamanavijayavardhan commited on
Commit
67fc68f
·
1 Parent(s): 8efbae1
Files changed (1) hide show
  1. templates/index.html +18 -24
templates/index.html CHANGED
@@ -1028,7 +1028,7 @@
1028
  <thead>
1029
  <tr>
1030
  <th>Student Folder</th>
1031
- <th>Image Name</th>
1032
  <th>Marks</th>
1033
  </tr>
1034
  </thead>
@@ -1037,29 +1037,27 @@
1037
  `;
1038
 
1039
  const tbody = table.querySelector('tbody');
1040
-
1041
- // Group results by student for calculating averages
1042
  const studentGroups = {};
1043
 
1044
- results.forEach(result => {
 
1045
  // Add row for individual marks
1046
- const row = document.createElement('tr');
1047
- row.innerHTML = `
1048
- <td>${result.student}</td>
1049
- <td>${result.image_name}</td>
1050
- <td>${result.marks}</td>
1051
- `;
1052
- tbody.appendChild(row);
 
 
1053
 
1054
- // Collect data for averages
1055
- if (!studentGroups[result.student]) {
1056
- studentGroups[result.student] = {
1057
- total: 0,
1058
- count: 0
1059
- };
1060
- }
1061
- studentGroups[result.student].total += result.marks;
1062
- studentGroups[result.student].count++;
1063
  });
1064
 
1065
  // Add separator row
@@ -1085,10 +1083,6 @@
1085
  // Add summary section
1086
  const summary = document.createElement('div');
1087
  summary.className = 'marks-summary';
1088
- summary.style.marginTop = '1rem';
1089
- summary.style.padding = '1rem';
1090
- summary.style.backgroundColor = '#e3f2fd';
1091
- summary.style.borderRadius = '8px';
1092
 
1093
  const totalStudents = Object.keys(studentGroups).length;
1094
  const overallAverage = Object.values(studentGroups)
 
1028
  <thead>
1029
  <tr>
1030
  <th>Student Folder</th>
1031
+ <th>Question Number</th>
1032
  <th>Marks</th>
1033
  </tr>
1034
  </thead>
 
1037
  `;
1038
 
1039
  const tbody = table.querySelector('tbody');
 
 
1040
  const studentGroups = {};
1041
 
1042
+ // Process the object format
1043
+ Object.entries(results).forEach(([student, marks]) => {
1044
  // Add row for individual marks
1045
+ marks.forEach((mark, index) => {
1046
+ const row = document.createElement('tr');
1047
+ row.innerHTML = `
1048
+ <td>${student}</td>
1049
+ <td>Question ${index + 1}</td>
1050
+ <td>${mark}</td>
1051
+ `;
1052
+ tbody.appendChild(row);
1053
+ });
1054
 
1055
+ // Calculate average for this student
1056
+ const total = marks.reduce((sum, mark) => sum + mark, 0);
1057
+ studentGroups[student] = {
1058
+ total: total,
1059
+ count: marks.length
1060
+ };
 
 
 
1061
  });
1062
 
1063
  // Add separator row
 
1083
  // Add summary section
1084
  const summary = document.createElement('div');
1085
  summary.className = 'marks-summary';
 
 
 
 
1086
 
1087
  const totalStudents = Object.keys(studentGroups).length;
1088
  const overallAverage = Object.values(studentGroups)