feat: centralize XP magic numbers in config file with shared level formula#47
Conversation
|
Someone is attempting to deploy a commit to the rishabhjtripathi2903-3434's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughTwo new ChangesXP Config Centralization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.0)app/src/sections/Dashboard.tsxFile contains syntax errors that prevent linting: Line 426: Expected corresponding JSX closing tag for 'div'.; Line 455: expected Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
SOLVE_XP,XP_PER_LEVEL)calculateLevel()utility used by both frontend and backendChanges
backend/src/config/xpConfig.ts: New config file withSOLVE_XP = 25,XP_PER_LEVEL = 1000, andcalculateLevel()functionapp/src/utils/xpConfig.ts: Frontend copy of the same config for shared consistencybackend/src/controllers/userActionController.ts: Replacedincrement: 25/decrement: 25withSOLVE_XPbackend/src/controllers/userController.ts: Replaced inline level formula withcalculateLevel()app/src/sections/Dashboard.tsx: UsesSOLVE_XP,XP_PER_LEVEL,calculateLevel(); XP card has tooltip: "Earn 25 XP per solved problem. Every 1,000 XP = 1 Level."app/src/sections/DailyChallenges.tsx: UsesSOLVE_XPin toast and XP labelsapp/src/sections/TopicDetail.tsx: UsesSOLVE_XPin toastapp/src/sections/Problems.tsx: UsesSOLVE_XPin toastFiles Modified
backend/src/config/xpConfig.tsapp/src/utils/xpConfig.tsbackend/src/controllers/userActionController.tsSOLVE_XPreplaces25backend/src/controllers/userController.tscalculateLevel()replaces inline formulaapp/src/sections/Dashboard.tsxSOLVE_XP,XP_PER_LEVEL,calculateLevel(), tooltipapp/src/sections/DailyChallenges.tsxSOLVE_XPin toast/labelsapp/src/sections/TopicDetail.tsxSOLVE_XPin toastapp/src/sections/Problems.tsxSOLVE_XPin toastCloses
closes #21
Summary by CodeRabbit