-
Notifications
You must be signed in to change notification settings - Fork 0
/
progress_dashboard.html
624 lines (571 loc) · 23.2 KB
/
progress_dashboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<link rel="icon" href="logo.png" sizes="16x16" type="image/png">
<link rel="icon" href="logo.png" sizes="32x32" type="image/png">
<title>Python 30-Day Project - Progress Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #1a1f2c;
--secondary-color: #242a38;
--accent-color: #4f46e5;
--text-color: #e2e8f0;
--muted-color: #94a3b8;
--success-color: #22c55e;
--border-color: rgba(255, 255, 255, 0.1);
}
body {
background-color: var(--primary-color);
color: var(--text-color);
font-family: 'Inter', sans-serif;
line-height: 1.6;
}
.dashboard-container {
padding: 2rem;
max-width: 1400px;
margin: 0 auto;
}
.header {
text-align: center;
margin-bottom: 3rem;
padding: 2rem 0;
border-bottom: 1px solid var(--border-color);
}
.header h1 {
font-weight: 700;
color: white;
margin-bottom: 0.5rem;
font-size: 2.5rem;
}
.last-updated {
color: var(--muted-color);
font-size: 0.9rem;
}
.stats-card {
background-color: var(--secondary-color);
border-radius: 1rem;
padding: 1.5rem;
margin-bottom: 1rem;
border: 1px solid var(--border-color);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
transition: transform 0.2s ease;
}
.stats-card:hover {
transform: translateY(-2px);
}
.stats-card h4 {
color: var(--muted-color);
font-size: 0.875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 0.75rem;
}
.stats-card h2 {
color: white;
font-size: 2rem;
font-weight: 700;
margin: 0;
}
.chart-container {
background-color: var(--secondary-color);
border-radius: 1rem;
padding: 1.5rem;
margin-bottom: 2rem;
border: 1px solid var(--border-color);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.chart-container h3 {
color: white;
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1.5rem;
}
.chart-wrapper {
height: 400px;
position: relative;
}
.table {
color: var(--text-color);
margin-bottom: 0;
}
.table thead th {
background-color: rgba(79, 70, 229, 0.1);
color: white;
font-weight: 600;
border-bottom: 2px solid var(--accent-color);
padding: 1rem;
}
.table tbody td {
padding: 1rem;
vertical-align: middle;
border-bottom: 1px solid var(--border-color);
}
.progress {
height: 0.5rem;
background-color: rgba(79, 70, 229, 0.1);
border-radius: 1rem;
}
.progress-bar {
background-color: var(--accent-color);
border-radius: 1rem;
}
.status-badge {
padding: 0.25rem 0.75rem;
border-radius: 1rem;
font-size: 0.875rem;
font-weight: 500;
}
.nav-tabs {
border-bottom: 1px solid var(--border-color);
}
.nav-tabs .nav-link {
color: var(--muted-color);
border: none;
border-bottom: 2px solid transparent;
padding: 0.75rem 1rem;
}
.nav-tabs .nav-link:hover {
color: var(--text-color);
border-color: transparent;
}
.nav-tabs .nav-link.active {
color: var(--accent-color);
background: none;
border-bottom: 2px solid var(--accent-color);
}
.badge {
padding: 0.35em 0.65em;
font-size: 0.75em;
font-weight: 600;
border-radius: 0.25rem;
}
.bg-success {
background-color: var(--success-color) !important;
}
.bg-danger {
background-color: #ef4444 !important;
}
</style>
</head>
<body>
<div class="dashboard-container">
<div class="header">
<h1>Python 30-Day Project Dashboard</h1>
<p class="last-updated">Last updated: <span id="lastUpdated"></span></p>
</div>
<div class="row g-4">
<div class="col-md-3">
<div class="stats-card">
<h4>Total Submissions</h4>
<h2 id="totalSubmissions">-</h2>
</div>
</div>
<div class="col-md-3">
<div class="stats-card">
<h4>Average Completion</h4>
<h2 id="avgCompletion">-</h2>
</div>
</div>
<div class="col-md-3">
<div class="stats-card">
<h4>Active Days</h4>
<h2 id="activeDays">-</h2>
</div>
</div>
<div class="col-md-3">
<div class="stats-card">
<h4>Total Students</h4>
<h2 id="totalStudents">-</h2>
</div>
</div>
</div>
<div class="row mt-4 g-4">
<div class="col-md-6">
<div class="chart-container">
<h3>Student Completion Rates</h3>
<div class="chart-wrapper">
<canvas id="completionChart"></canvas>
</div>
</div>
</div>
<div class="col-md-6">
<div class="chart-container">
<h3>Daily Submission Trends</h3>
<div class="chart-wrapper">
<canvas id="submissionChart"></canvas>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<div class="chart-container">
<h3>Student Progress Overview</h3>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Student Name</th>
<th>Files Submitted</th>
<th>Days Completed</th>
<th style="width: 30%">Progress</th>
<th>Completion</th>
</tr>
</thead>
<tbody id="studentTableBody"></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="studentModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content" style="background-color: var(--secondary-color); color: var(--text-color);">
<div class="modal-header border-bottom border-light">
<h5 class="modal-title" id="studentName">Student Details</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="row g-4 mb-4">
<div class="col-md-3">
<div class="stats-card">
<h4>Total Lines</h4>
<h2 id="studentTotalLines">-</h2>
</div>
</div>
<div class="col-md-3">
<div class="stats-card">
<h4>Functions</h4>
<h2 id="studentFunctions">-</h2>
</div>
</div>
<div class="col-md-3">
<div class="stats-card">
<h4>Classes</h4>
<h2 id="studentClasses">-</h2>
</div>
</div>
<div class="col-md-3">
<div class="stats-card">
<h4>Completion</h4>
<h2 id="studentCompletion">-</h2>
</div>
</div>
</div>
<ul class="nav nav-tabs mb-4" id="studentDetailTabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="overview-tab" data-bs-toggle="tab" href="#overview">Overview</a>
</li>
<li class="nav-item">
<a class="nav-link" id="daily-tab" data-bs-toggle="tab" href="#daily">Daily Progress</a>
</li>
<li class="nav-item">
<a class="nav-link" id="files-tab" data-bs-toggle="tab" href="#files">Files</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="overview">
<div class="chart-container">
<h3>Progress Overview</h3>
<div class="chart-wrapper">
<canvas id="studentProgressChart"></canvas>
</div>
</div>
</div>
<div class="tab-pane fade" id="daily">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Day</th>
<th>Files</th>
<th>Lines of Code</th>
<th>Comments</th>
<th>Functions</th>
<th>Classes</th>
<th>Status</th>
</tr>
</thead>
<tbody id="dailyProgressBody"></tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="files">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Day</th>
<th>File Name</th>
<th>Lines</th>
<th>Functions</th>
<th>Classes</th>
<th>Size</th>
</tr>
</thead>
<tbody id="fileDetailsBody"></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
async function loadDashboardData() {
try {
const response = await fetch('./chart_data.json');
const data = await response.json();
updateSummaryStats(data);
initializeCharts(data);
updateStudentTable(data);
} catch (error) {
console.error('Error loading dashboard data:', error);
}
}
function updateSummaryStats(data) {
document.getElementById('totalSubmissions').textContent =
Object.values(data.daily_submissions || {}).reduce((a, b) => a + b, 0);
document.getElementById('avgCompletion').textContent =
`${(Object.values(data.completion_rates || {}).reduce((a, b) => a + b, 0) /
(Object.keys(data.completion_rates || {}).length || 1)).toFixed(1)}%`;
document.getElementById('activeDays').textContent =
Object.keys(data.daily_submissions || {}).length;
document.getElementById('totalStudents').textContent =
Object.keys(data.student_progress || {}).length;
document.getElementById('lastUpdated').textContent =
new Date().toLocaleString();
}
function initializeCharts(data) {
new Chart(document.getElementById('completionChart').getContext('2d'), {
type: 'bar',
data: {
labels: Object.keys(data.completion_rates),
datasets: [{
label: 'Completion Rate',
data: Object.values(data.completion_rates),
backgroundColor: '#4f46e5',
borderRadius: 6
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#94a3b8'
}
},
x: {
grid: {
display: false
},
ticks: {
color: '#94a3b8'
}
}
}
}
});
new Chart(document.getElementById('submissionChart').getContext('2d'), {
type: 'line',
data: {
labels: Object.keys(data.daily_submissions),
datasets: [{
label: 'Submissions',
data: Object.values(data.daily_submissions),
borderColor: '#4f46e5',
tension: 0.4,
fill: true,
backgroundColor: 'rgba(79, 70, 229, 0.1)'
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#94a3b8'
}
},
x: {
grid: {
display: false
},
ticks: {
color: '#94a3b8'
}
}
}
}
});
}
function updateStudentTable(data) {
const studentTableBody = document.getElementById('studentTableBody');
studentTableBody.innerHTML = '';
Object.entries(data.student_progress || {}).forEach(([name, progress]) => {
const row = document.createElement('tr');
row.style.cursor = 'pointer';
row.onclick = () => showStudentDetails(name, progress, data);
row.innerHTML = `
<td>${name}</td>
<td>${progress.total_files}</td>
<td>${progress.completed_days}</td>
<td>
<div class="progress">
<div class="progress-bar" role="progressbar"
style="width: ${data.completion_rates[name]}%">
</div>
</div>
</td>
<td>${data.completion_rates[name].toFixed(1)}%</td>
`;
studentTableBody.appendChild(row);
});
}
function showStudentDetails(name, progress, data) {
const modal = new bootstrap.Modal(document.getElementById('studentModal'));
document.getElementById('studentName').textContent = name;
// Update summary stats
document.getElementById('studentTotalLines').textContent = progress.total_lines;
document.getElementById('studentCompletion').textContent =
`${data.completion_rates[name].toFixed(1)}%`;
let totalFunctions = 0;
let totalClasses = 0;
Object.values(progress.detailed_daily_stats).forEach(day => {
totalFunctions += day.functions;
totalClasses += day.classes;
});
document.getElementById('studentFunctions').textContent = totalFunctions;
document.getElementById('studentClasses').textContent = totalClasses;
// Update daily progress table
const dailyProgressBody = document.getElementById('dailyProgressBody');
dailyProgressBody.innerHTML = '';
// Get all possible days
const allDays = Array.from({length: 30}, (_, i) => `Day ${i + 1}`);
allDays.forEach(day => {
const stats = progress.detailed_daily_stats[day] || {
files: 0,
code_lines: 0,
comment_lines: 0,
functions: 0,
classes: 0
};
const row = document.createElement('tr');
const status = stats.files > 0 ?
'<span class="badge bg-success">Completed</span>' :
'<span class="badge bg-danger">Missing</span>';
row.innerHTML = `
<td>${day}</td>
<td>${stats.files}</td>
<td>${stats.code_lines}</td>
<td>${stats.comment_lines}</td>
<td>${stats.functions}</td>
<td>${stats.classes}</td>
<td>${status}</td>
`;
dailyProgressBody.appendChild(row);
});
// Update file details table
const fileDetailsBody = document.getElementById('fileDetailsBody');
fileDetailsBody.innerHTML = '';
Object.entries(progress.detailed_daily_stats).forEach(([day, stats]) => {
stats.file_details.forEach(file => {
const row = document.createElement('tr');
const size = (file.size / 1024).toFixed(2);
row.innerHTML = `
<td>${day}</td>
<td>${file.name}</td>
<td>${file.lines}</td>
<td>${file.functions}</td>
<td>${file.classes}</td>
<td>${size} KB</td>
`;
fileDetailsBody.appendChild(row);
});
});
// Create progress chart
const ctx = document.getElementById('studentProgressChart').getContext('2d');
if (window.studentChart) {
window.studentChart.destroy();
}
window.studentChart = new Chart(ctx, {
type: 'line',
data: {
labels: Object.keys(progress.daily_submissions),
datasets: [{
label: 'Files Submitted',
data: Object.values(progress.daily_submissions),
borderColor: '#4f46e5',
tension: 0.4,
fill: true,
backgroundColor: 'rgba(79, 70, 229, 0.1)'
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#94a3b8'
}
},
x: {
grid: {
display: false
},
ticks: {
color: '#94a3b8'
}
}
}
}
});
modal.show();
}
document.addEventListener('DOMContentLoaded', loadDashboardData);
</script>
</body>
</html>