-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress-view.html
More file actions
44 lines (44 loc) · 1.87 KB
/
Copy pathprogress-view.html
File metadata and controls
44 lines (44 loc) · 1.87 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Progress View - Programming Learning System</title>
<style>
body { font-family: Arial; background:#f5f5f5; margin:0; padding:20px; text-align:center; }
.container { max-width:500px; margin:auto; background:white; padding:20px; border-radius:15px; box-shadow:0 4px 10px rgba(0,0,0,0.2);}
h1 { color:#A389D4; margin-bottom:15px; }
p { font-size:18px; color:#555; margin:15px 0; }
button { display:inline-block; margin:10px 5px; padding:10px 15px; font-size:16px; border:none; border-radius:10px; background:#A389D4; color:white; cursor:pointer;}
button:hover { background:#8e74c1; }
</style>
</head>
<body>
<div class="container">
<h1 id="title">Progress</h1>
<p id="score">Loading...</p>
<button onclick="window.location.href='progress-menu.html'">Back to Progress Menu</button>
<button onclick="window.location.href='dashboard.html'">Back to Dashboard</button>
</div>
<script>
// --- GET LANGUAGE AND LEVEL FROM URL ---
const params = new URLSearchParams(window.location.search);
const language = params.get('language') || 'python';
const level = params.get('level') || 'beginner';
// --- UPDATE TITLE ---
document.getElementById('title').innerText = `${language.toUpperCase()} (${level.charAt(0).toUpperCase() + level.slice(1)}) Progress`;
// --- GET SCORE PER USER ---
const username = localStorage.getItem('username'); // logged-in user
const scoreKey = `${username}-${language}-${level}-lastScore`;
let score = localStorage.getItem(scoreKey);
if(score === null){
score = "No quiz taken yet";
} else {
const quizLength = 10; // all levels have 10 questions
score = `${score}/${quizLength}`;
}
// --- DISPLAY SCORE ---
document.getElementById('score').innerText = `Last Score: ${score}`;
</script>
</body>
</html>