Neurolingua commited on
Commit
da867de
1 Parent(s): 1606e9c

Update templates/teacher.html

Browse files
Files changed (1) hide show
  1. templates/teacher.html +54 -49
templates/teacher.html CHANGED
@@ -1016,7 +1016,7 @@
1016
  .then(response => response.json())
1017
  .then(data => {
1018
  const reportDiv = document.createElement('div');
1019
- reportDiv.innerHTML = <h3>AI Generated Report</h3><p>${data.report}</p>;
1020
  studentExpandedInfo.appendChild(reportDiv);
1021
  })
1022
  .catch((error) => {
@@ -1043,11 +1043,11 @@
1043
  const numberOfSubjects = parseInt(this.value);
1044
  for (let i = 0; i < numberOfSubjects; i++) {
1045
  const subjectLabel = document.createElement('label');
1046
- subjectLabel.textContent = Subject ${i + 1}:;
1047
 
1048
  const subjectInput = document.createElement('input');
1049
  subjectInput.type = 'text';
1050
- subjectInput.name = subject_${i + 1};
1051
  subjectInput.required = true;
1052
 
1053
  subjectsContainer.appendChild(subjectLabel);
@@ -1206,55 +1206,60 @@
1206
  });
1207
 
1208
  </script>
1209
- <script>
1210
- // Extract weekly performance data from the template
1211
- const weeklyPerformanceData = JSON.parse('{{ teacher.weekly_class_performance|tojson|safe }}');
1212
 
1213
- // Prepare data for Chart.js
1214
- const ctx = document.getElementById('performanceChart').getContext('2d');
1215
- const labels = Object.keys(weeklyPerformanceData);
1216
- const datasets = labels.map(label => ({
1217
- label: label,
1218
- data: weeklyPerformanceData[label],
1219
- borderColor: getRandomColor(),
1220
- fill: false
1221
- }));
1222
-
1223
- const performanceChart = new Chart(ctx, {
1224
- type: 'line',
1225
- data: {
1226
- labels: Array.from({length: 7}, (_, i) => Week ${i + 1}),
1227
- datasets: datasets
1228
- },
1229
- options: {
1230
- responsive: true,
1231
- scales: {
1232
- x: {
1233
- title: {
1234
- display: true,
1235
- text: 'Weeks'
1236
- }
1237
- },
1238
- y: {
1239
- title: {
1240
- display: true,
1241
- text: 'Performance Score'
1242
- },
1243
- beginAtZero: true
1244
- }
1245
- }
1246
- }
1247
- });
1248
-
1249
- function getRandomColor() {
1250
- const letters = '0123456789ABCDEF';
1251
- let color = '#';
1252
- for (let i = 0; i < 6; i++) {
1253
- color += letters[Math.floor(Math.random() * 16)];
1254
  }
1255
- return color;
 
 
 
 
 
 
1256
  }
1257
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1258
 
1259
 
1260
  </body>
 
1016
  .then(response => response.json())
1017
  .then(data => {
1018
  const reportDiv = document.createElement('div');
1019
+ reportDiv.innerHTML = `<h3>AI Generated Report</h3><p>${data.report}</p>`;
1020
  studentExpandedInfo.appendChild(reportDiv);
1021
  })
1022
  .catch((error) => {
 
1043
  const numberOfSubjects = parseInt(this.value);
1044
  for (let i = 0; i < numberOfSubjects; i++) {
1045
  const subjectLabel = document.createElement('label');
1046
+ subjectLabel.textContent = `Subject ${i + 1}:`;
1047
 
1048
  const subjectInput = document.createElement('input');
1049
  subjectInput.type = 'text';
1050
+ subjectInput.name = `subject_${i + 1}`;
1051
  subjectInput.required = true;
1052
 
1053
  subjectsContainer.appendChild(subjectLabel);
 
1206
  });
1207
 
1208
  </script>
 
 
 
1209
 
1210
+
1211
+ <script>
1212
+ // Extract weekly performance data from the template
1213
+ const weeklyPerformanceData = JSON.parse('{{ teacher.weekly_class_performance|tojson|safe }}');
1214
+
1215
+ // Prepare data for Chart.js
1216
+ const ctx = document.getElementById('performanceChart').getContext('2d');
1217
+ const labels = Object.keys(weeklyPerformanceData);
1218
+ const datasets = labels.map(label => ({
1219
+ label: label,
1220
+ data: weeklyPerformanceData[label],
1221
+ borderColor: getRandomColor(),
1222
+ fill: false
1223
+ }));
1224
+
1225
+ const performanceChart = new Chart(ctx, {
1226
+ type: 'line',
1227
+ data: {
1228
+ labels: Array.from({length: 7}, (_, i) => `Week ${i + 1}`),
1229
+ datasets: datasets
1230
+ },
1231
+ options: {
1232
+ responsive: true,
1233
+ scales: {
1234
+ x: {
1235
+ title: {
1236
+ display: true,
1237
+ text: 'Weeks'
 
 
 
 
 
 
 
 
 
 
 
 
 
1238
  }
1239
+ },
1240
+ y: {
1241
+ title: {
1242
+ display: true,
1243
+ text: 'Performance Score'
1244
+ },
1245
+ beginAtZero: true
1246
  }
1247
+ }
1248
+ }
1249
+ });
1250
+
1251
+ function getRandomColor() {
1252
+ const letters = '0123456789ABCDEF';
1253
+ let color = '#';
1254
+ for (let i = 0; i < 6; i++) {
1255
+ color += letters[Math.floor(Math.random() * 16)];
1256
+ }
1257
+ return color;
1258
+ }
1259
+ </script>
1260
+
1261
+ </body>
1262
+ </html>
1263
 
1264
 
1265
  </body>