Summary
quiz.html (232 lines, fully reviewed) implements a complete quiz engine
with timer, score tracking, progress bar, and results display — entirely
in client-side JavaScript (scripts/quiz.js + scripts/quiz-data.js).
The results section renders:
<span id="finalScore" class="result-value">0/10</span>
<span id="timeTaken" class="result-value">00:00</span>
<span id="correctAnswers" class="result-value">0</span>
<span id="incorrectAnswers" class="result-value">0</span>
But these values are never sent to the Flask backend. The moment the
user navigates away, refreshes, or closes the tab — all quiz results
are permanently lost. There is no score history, no progress tracking,
and no foundation for the Leaderboard system listed under
Future Enhancements.
Concrete User Impact
- A student completes the Web Development Quiz scoring 9/10 in 4:32 —
closes the tab — score is gone forever
- There is no "My Results" page because no results are ever persisted
- The AI guidance feature (
ai.html) cannot personalize recommendations
based on quiz performance because performance data is never stored
- The future Leaderboard cannot be built without a database-backed
score persistence layer
Why This Blocks Future Features
The README lists these under Future Enhancements:
- Leaderboard system — requires stored scores per user per quiz
- Advanced learning analytics — requires historical score data
- Enhanced AI personalization — requires knowing what a user
scored on which topics to tailor guidance
None of these can be implemented without this foundation.
Proposed Fix
1. Backend endpoint for score persistence:
# backend/app.py
from datetime import datetime
@app.route("/api/quiz/submit", methods=["POST"])
def submit_quiz():
if "user_id" not in session:
return jsonify({"error": "Unauthorized"}), 401
data = request.get_json()
# Store: user_id, course, score, total, time_taken, completed_at
save_quiz_result(
user_id=session["user_id"],
course=data["course"], # "webdev", "ai", "career"
score=data["score"],
total=data["total"],
time_taken=data["timeTaken"],
completed_at=datetime.utcnow()
)
return jsonify({"status": "saved"})
@app.route("/api/quiz/history")
def quiz_history():
if "user_id" not in session:
return jsonify({"error": "Unauthorized"}), 401
return jsonify(get_user_quiz_history(session["user_id"]))
2. Frontend — POST results on quiz submission:
// scripts/quiz.js — add after displaying results:
async function saveResult(course, score, total, timeTaken) {
await fetch("http://127.0.0.1:5000/api/quiz/submit", {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify({ course, score, total, timeTaken })
});
}
// Call saveResult() inside the existing submitQuiz() handler
3. Add /history page showing past attempts per course.
Acceptance Criteria
Labels: enhancement, backend, feature, level: intermediate
Summary
quiz.html(232 lines, fully reviewed) implements a complete quiz enginewith timer, score tracking, progress bar, and results display — entirely
in client-side JavaScript (
scripts/quiz.js+scripts/quiz-data.js).The results section renders:
But these values are never sent to the Flask backend. The moment the
user navigates away, refreshes, or closes the tab — all quiz results
are permanently lost. There is no score history, no progress tracking,
and no foundation for the Leaderboard system listed under
Future Enhancements.
Concrete User Impact
closes the tab — score is gone forever
ai.html) cannot personalize recommendationsbased on quiz performance because performance data is never stored
score persistence layer
Why This Blocks Future Features
The README lists these under Future Enhancements:
scored on which topics to tailor guidance
None of these can be implemented without this foundation.
Proposed Fix
1. Backend endpoint for score persistence:
2. Frontend — POST results on quiz submission:
3. Add
/historypage showing past attempts per course.Acceptance Criteria
POST /api/quiz/submitendpoint saves score, course, time, timestampbackend/app.pyscripts/quiz.jsPOSTs results to backend on quiz submissionGET /api/quiz/historyreturns user's past quiz resultshistory.htmlpage renders quiz history per courseLabels:
enhancement,backend,feature,level: intermediate