Skip to content

feat: Added XP and level tracking to users#212

Merged
phertyameen merged 14 commits intoMindBlockLabs:mainfrom
devchant:XP-Level-Tracking
Jan 30, 2026
Merged

feat: Added XP and level tracking to users#212
phertyameen merged 14 commits intoMindBlockLabs:mainfrom
devchant:XP-Level-Tracking

Conversation

@devchant
Copy link
Contributor

XP and Level Tracking System Implementation

Closes #99

This PR implements a comprehensive XP and Level tracking system for users. The core logic is encapsulated in a new XpLevelService (src/users/providers/xp-level.service.ts), which calculates levels using the rule 500 XP = 1 Level (Math.floor(xp / 500) + 1) and tracks xp, level, and nextLevel (XP remaining until the next level). A new API endpoint GET /users/:id/xp-level has been added to the UsersController, returning user progression data. Example response:

{
  "level": 2,
  "xp": 550,
  "nextLevel": 1000
}

XP is automatically awarded through integration with the puzzle engine via ProgressCalculationProvider, ensuring gamification is seamless. Unit tests (xp-level.service.spec.ts) verify all core scenarios, including XP accumulation, leveling up, and calculation of the next level threshold, and all tests are passing. Additionally, a bug in the User entity's progressRecords mapping was fixed, ensuring consistency of progress data.

The implementation follows clean architecture principles, consolidating logic within UsersModule and ProgressModule while avoiding circular dependencies. The build passes successfully (npm run build), and these changes are designed to be fully backward-compatible, isolated, and non-breaking for existing workflows.

image

@devchant
Copy link
Contributor Author

@phertyameen 👋🙂. Patiently waiting for your review.
Feel free to give some bonus point 😊🚀. it will really go a looooong way .
Thank you 🤞

@devchant
Copy link
Contributor Author

@phertyameen . still waiting patiently for your review🙂
Also the extra points will really go a long way honestly

Copy link
Member

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean. Just remove the file .\xp-level-test.ps1 and your pr is ready to merge. Tag me when you do'

@devchant
Copy link
Contributor Author

@phertyameen 🫡. i am done with the changes you requested.
Also concerning the extra points 😊 it will go a long way . started the wave very late so i currently have 0 total points . your point will really boost my scores

@devchant
Copy link
Contributor Author

@phertyameen 🫡 GM GM, waiting very patiently for your review.
sorry i hand to POINT it out.
oh speaking of POINTS 🫲😊🫱...

okay let me not overemphasize , but you get the Point 😁

@phertyameen
Copy link
Member

phertyameen commented Jan 28, 2026

@devchant I hear you. Please checkout CONTRIBUTING.md for build test to fic build/cicd errors

@devchant devchant requested a review from phertyameen January 29, 2026 11:48
@devchant
Copy link
Contributor Author

@phertyameen thank you so much for the patience. current done fixing pipeline

@devchant
Copy link
Contributor Author

@phertyameen . 🙂 Patiently waiting for your review boss.

Copy link
Member

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see alot of file changes with every commit. Hold on a minute! don't push any changes. let me help a little bit.

Copy link
Member

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the solution is there somewhere, It is not worth it to merge this pr with all these changes. In the future, closing the pr and exiting the branch might be your best bet. I will make a final commit before merging this though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid messing with this files configuration in any project in the future!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless your issue explicitly tells you to, avoid this app too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you were never ment to touch this file. Some lint errors definitly came from here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ttouching this is dangerous

findAll(@Query() query: PuzzleQueryDto) {
return this.puzzlesService.findAll(query);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not ment to remove any endpoint

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a needed file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

fixex

fixes
@phertyameen phertyameen merged commit f656b4d into MindBlockLabs:main Jan 30, 2026
3 checks passed
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 XP and level tracking to users

2 participants