feat: Implemented Recovery Missions and Weekly/Custom Contest for Students engagement! - #89
Open
harshu167 wants to merge 2 commits into
Open
feat: Implemented Recovery Missions and Weekly/Custom Contest for Students engagement!#89harshu167 wants to merge 2 commits into
harshu167 wants to merge 2 commits into
Conversation
…ab, resolve layout issues & add dev scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary & TL;DR
Why should this be implemented?
As students progress through the curriculum, they inevitably encounter "setbacks"—whether due to a drop in attendance, missing polls, or failing a quiz. Traditional dashboards merely report these metrics, which can lead to demotivation and dropout.
This PR implements two core engines to convert setbacks into engagement opportunities:
Key Features Implemented
1. Setback Detection & Dynamic Recovery Engine
2. Gamified Contests (Reinforcement Loop)
3. Secure AI & Admin Configuration Manager
Visual Walkthrough & UI States
Student Dashboards
Figure 1: Recovery Missions & Setback Alerts
Figure 2: Available Contests Dashboard
Figure 3: Word Scramble Lock
Figure 4: Time Attack Timed Quiz
Figure 5: Reflective Reflection Step
More: Walkthroughs
Codebase Modifications & Additions
Backend Abstractions & Models
AIConfig.js: Global singleton document managing API credentials, token limits, and daily caps.Contest.js&ContestAttempt.js: Stores question structures, scrambled keywords, passing requirements, and logs attempt history.Mission.js&MissionAttempt.js: Tracks tasks, trigger rules, dates, active streaks, and current states (active,completed,failed).Services & Routes
crypto.js: Symmetric AES-256-GCM key derivation for encrypting external API keys at rest.aiProvider.js: Standardized LLM adapter handling text cleanup, prompt layouts, and daily usage guardrails.server.js: Integrates JWT/cookie authorization middleware to ensure tamper-proof sessions, and registers/api/contest,/api/missions, and/api/ai-configendpoints.Client Dashboards (
main.jsx/styles.css)<StudentContestTab />,<StudentMissionsTab />,<ContestAdminPanel />,<MissionAdminPanel />, and<ContestAIConfig />.🧪 Verification & Test Coverage
Two automated test suites were run and verified successfully to guarantee transaction ledger consistency, anti-tampering guards, and end-to-end flow completeness:
tests/contest_balance.test.mjs: Ensures double-spend prevention and that transactions update the student's SP ledger atomically.tests/contest_smoke.test.mjs: Validates authentication priority (cookie vs. header), spoofing resistance, and submission rate-limiting.Test Execution Output