Added Achievement System For Gaming Stats API Endpoints#185
Merged
alliekameda merged 2 commits intomainfrom Apr 29, 2025
Merged
Added Achievement System For Gaming Stats API Endpoints#185alliekameda merged 2 commits intomainfrom
alliekameda merged 2 commits intomainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
===========================================
+ Coverage 63.92% 81.16% +17.23%
===========================================
Files 15 17 +2
Lines 596 775 +179
Branches 45 51 +6
===========================================
+ Hits 381 629 +248
+ Misses 194 123 -71
- Partials 21 23 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
omgdory
approved these changes
Apr 29, 2025
Contributor
omgdory
left a comment
There was a problem hiding this comment.
🔍 Peer Review
✅ What Looks Great
- Requests need the appropriate authentication level (permission class).
- Admin panel implementation is sophisticated, making the testing very easy to follow.
- Code is clean and modular. Corresponding views look good with related URLs updated.
💡 Suggestions for Improvement (if any)
- Making the progress field some type of percentage (out of 100%) rather than a positive integer.
- Refactoring the code use allocated responsibility from
managers.pyrather than re-writing them inviews.py. - Everything else mentioned in the body of your PR!
🧪 Tested This Feature
Checklist:
- Do the endpoints return correct data and status codes?
- Is logic properly encapsulated in the manager, not in views?
- Do serializers validate and serialize data accurately?
- Are naming conventions and code style consistent?
🔄 Next Steps
- See "Suggestions for Improvement" above.
- Create tests to follow test-driven development practices.
- Continue to other features/issues!
🚀 Final Thoughts
Great work! Can't wait to see this live 🦅
aviendha-andrus
approved these changes
Apr 29, 2025
Contributor
There was a problem hiding this comment.
🔍 Peer Review: Great Job on This PR!
Hey Allison 👋 — just finished reviewing your PR titled "Added Achievement System For Gaming Stats API Endpoints". Here’s my feedback:
✅ What Looks Great
- The core feature has been implemented cleanly
- The PR description is thorough, clear, and fully aligned with our PR template making it easy to review.
- You've properly linked to the related issue (#108) and included a helpful testing guide.
💡 Suggestions for Improvement (if any)
- Consider adding unit and integration tests for
StudentAchievementManagermethods to ensure long-term reliability. - The
PATCHendpoint for progress updates could include validation for threshold logic, if not already done in the manager. - As noted in your Next Steps, hooking this into signals (from Pomodoro/pet models) will streamline the gamified experience.
- Include a UML diagram next time for PRs introducing multiple interdependent models and logic layers — really helps visualize flow.
- Add an
AchievementCreateAPIViewto allow admins or staff users to create new achievements through the API.- Right now, achievements must be manually added via the admin panel or database.
- Creating a
CreateAPIViewand adding it tourls.py(e.g.,path('achievements/create/', ...)) will make future admin tools or interfaces easier to build. - This will also help QA test full achievement flow end-to-end using
curlor Postman.
🧪 Tested This Feature
I ran the following test steps:
- ✅ Accessed the
/achievements/endpoint and verified the listing of all achievements. - ✅ POSTed to
/achievements/student_achievements/with test data to award an achievement. - ✅ Fetched a student’s achievements via
GET /achievements/student_achievements/{student_id}/.
Everything behaved as expected 🎉
🔄 Next Steps
- Looking forward to seeing unit tests in the next PR!
- Consider implementing the
AchievementCreateAPIViewto complete the admin-side creation cycle. - Make sure you make migrations before merging!
🚀 Final Thoughts
Great job with this implementation! This looks really great :3
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.
Added Achievement System For Gaming Stats API Endpoints
Add API Endpoints and Custom Manager for Achievement Tracking System
Overview
What does this PR do?
This PR introduces REST API endpoints and a custom manager to handle tracking, awarding, and updating progress on student achievements tied to Pomodoro sessions, pet collection, and pet evolution. It follows the Fat Model, Skinny View design philosophy for maintainable and scalable backend logic.
Key Features & Changes
What has been added or changed?
✔ Core Feature Implementation: API views for listing achievements, awarding achievements to students, and updating student achievement progress.
✔ Refactored Business Logic: Introduced a custom manager to encapsulate common operations such as awarding and unlocking achievements.
✔ New Components/Files:
views.py— added viewsets forAchievementandStudentAchievement.serializers.py— created serializers for both models.urls.py— registered new endpoints.managers.py— custom manager and queryset forStudentAchievement.Why This Is Needed
What problem does this solve?
This implementation allows automated tracking and rewarding of student accomplishments, creating a gamified experience to boost engagement and motivation. It also enables scalable achievement logic that can be reused across other systems like Pomodoro and pets.
Related Issue
🔗 This PR closes API endpoints for Achievement System For Gaming Stats #108
Implementation Details
How was this feature developed?
StudentAchievementManager).StudentAchievementQuerySetto filter unlocked/in-progress achievements.@actiondecorators for custom API operations.Design Documentation (If Applicable)
N/A — follows standard DRF conventions and previously defined model structure.
How to Test This PR
Step-by-step testing guide
✅ Log in to the Django admin panel
✅ Navigate to the Achievements section
✅ Create a new Achievement for a user
✅ Create a Student Achievement
✅ Test via curl
Files Added/Modified
📂 List of important files changed in this PR
views.pyserializers.pyurls.pymanagers.pyAI Code Usage
🤖 Was AI-generated code used in this PR?
views.py,managers.py, and serializers with human review)Checklist for Reviewers
Things to check before approving this PR:
Next Steps & Future Enhancements
What improvements can be made after merging?
Final Notes
Thank you so much for your review!! Let me know if there's anything I can do for you ^^;