Skip to content

Pull Request: Finance Education Module Enhancements #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

adithya-adee
Copy link

@adithya-adee adithya-adee commented May 22, 2025

@Community-Programmer
name: 🚀 #ieesoc PR - Add education section
about: Propose changes to improve the project
title: "[FEATURE] Finance Education section"
labels: 'hard' 'frontend' 'backend'
assignees: '@adithya-adee'

Overview

This PR implements a comprehensive enhancement to the Finance Education module, adding gamification features, real-time progress tracking, and improved user engagement through achievements, learning paths, and interactive content.

Changes Summary

Backend Enhancements

  1. Fixed Route Handler Type Issues

    • Updated controller function signatures for proper Express.js compatibility
    • Made custom routes for all the education system
    • TODO: Can implement DRY principle
  2. Schema Updates

    • Added user education tracking fields to Prisma schema:
      • level: User's current education level
      • xp: Experience points accumulated
      • currentRank: User's current rank title (e.g., "Budget Master")
      • dailyStreak: Count of consecutive days with learning activity
      • lastActiveDate: Timestamp of last learning activity
  3. New API Endpoints

    • Created user statistics API with full CRUD operations
    • Added achievement tracking endpoints
    • Enhanced flashcard and learning path endpoints

    BEFORE USING IT MAKE SURE TO APPLY THE CHANGES TO YOUR DATABASE
    using npx prisma db push followed by npx prisma generate

Frontend Improvements

  1. Custom Hooks

    • useUserStats: Manages user education statistics with real-time updates
    • useAchievement: Handles achievement unlocking and tracking
    • useProgressPath: Calculates and tracks learning path completion
  2. Component Updates

    • EducationHub: Converted from static mock data to dynamic API-driven content
    • FeaturedLesson: Shows personalized lesson recommendations
    • PracticeList: Displays interactive flashcard decks from the API
    • AchievementsList: Shows unlocked and locked achievements
    • ProgressPath: Visualizes user progress through learning paths
  3. Interactive Learning

    • Added flashcard system with swipe/tap interactions
    • Implemented XP rewards for completing educational activities
    • Created daily streak mechanism to encourage regular engagement

Technical Details

API Endpoints Added/Modified

  • GET /api/v1/education/stats: Retrieve user stats
  • PUT /api/v1/education/stats: Update user stats
  • POST /api/v1/education/stats/add-xp: Add XP with level-up detection
  • GET /api/v1/education/stats/check-streak: Check and update daily streak
  • GET /api/v1/education/gamification/achievements: Get user achievements
  • POST /api/v1/education/gamification/achievement: Unlock new achievement

Type Safety Improvements

  • Added proper TypeScript interfaces for API responses
  • Removed unsafe type assertions
  • Enhanced error handling throughout the application

Testing Instructions

  1. Education Hub

    • Visit the Education Hub to see personalized stats
    • Complete activities to see XP and achievements update in real-time
  2. Learning Paths

    • Navigate through learning paths to see progress tracking
    • Complete lessons to see progress bars update
  3. Achievements

    • Check the Achievements tab to see available badges
    • Complete corresponding tasks to unlock achievements
  4. Practice

    • Browse and interact with flashcard decks
    • Swipe or tap to flip cards and navigate between them

CRITICAL: Authentication Issues & Workarounds

Authentication System Limitations

⚠️ LOGIN FUNCTIONALITY IS CURRENTLY NOT WORKING ⚠️

The integration between the frontend authentication flow and the education module endpoints is currently broken. The passport.js authentication middleware, JWT validation, and Google Auth integration fail to properly authenticate users in the Education Hub context.

Testing Methodology

Due to these authentication issues, I've tested the backend functionality using the following approach:

  • Used Postman to bypass the authentication layer entirely
  • Created custom test endpoints that don't require the passport.js middleware
  • Tested all core functionality without JWT validation or Google Auth dependencies

Current State & Workarounds

The good news is that despite authentication issues:

  1. The backend logic functions correctly when tested via direct API calls
  2. Error handling is robust and prevents crashes even without a valid user object
  3. The API endpoints return appropriate responses for both success and error cases
  4. Frontend components are prepared to handle the eventual authentication integration

TODO: Quiz Points Implementation

The logic for how quiz points are calculated, incremented, and stored needs to be implemented in the database layer. This should include:

  • Logic for calculating points based on quiz difficulty and correctness
  • Database transactions to ensure consistent point updates
  • Integration with the XP and level-up system
  • Achievement triggers based on quiz performance

TODO: Database injection with proper icons

The implementation of custom icons and SVG , updation of lesson , quizzes and flashcards. These implementation are meant to be carefully introduced in the database.

Timeline & Resource Constraints

IMPORTANT: Due to personal issues, I will be unavailable for the next 5 days. Given the critical nature of this feature for the upcoming release, I recommend that another team member takes over the implementation of, it might extend:

  1. Fixing the authentication flow
  2. Implementing the quiz points logic
  3. Completing the integration between the frontend and backend

All the groundwork has been laid out in the current PR, and the custom hooks (particularly useUserStats.addXp) are ready to be connected to the quiz completion flow once authentication is fixed.

Closes #13

- Implement achievement & progress hooks for global addressing
- Add Education Page with Gamification for sample data
- Implement tabs to switch tabs (Learn, Practice, Achievement)

feat(Fix):
- Fix all critical issues : missing components & unimported files & mismatched routes
Implement api calls for Education Component
TODO: fix it
Add custom spinner to load
Implement components in Education Hub
@Community-Programmer
Copy link
Owner

@adithya-adee Is this completed ?
Or something else is remaining

@adithya-adee
Copy link
Author

adithya-adee commented May 26, 2025

I have completed my part, making the finance education but there are some errors which already existed and things to do for your website. And I have handled errors efficiently

TODO:

  • Fix the authentication for the website( there are issues in login )
  • Update the database with new learning cards , and flashcards) and I have created routes for it.
  • quiz implementation for the lesson, these are dependent on learning cards that are created

@adithya-adee
Copy link
Author

@Community-Programmer , from the above comments :
Can you make sure to assign these todos to someone else? @Community-Programmer, could you please assign these TODO: tasks to someone else, and the login error is already a persistent issue? Thank you!

@adithya-adee
Copy link
Author

@Community-Programmer , can you merge this branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an educational section with lessons, flashcards, and quizzes to boost financial literacy
2 participants