Submission Analytics Dashboard for Admins (T113 )#46#66
Merged
krishnapaljadeja merged 12 commits intogdg-charusat:mainfrom Feb 28, 2026
Merged
Submission Analytics Dashboard for Admins (T113 )#46#66krishnapaljadeja merged 12 commits intogdg-charusat:mainfrom
krishnapaljadeja merged 12 commits intogdg-charusat:mainfrom
Conversation
Contributor
✅ PR Validation PassedHey @tarun-baranwal! Your PR looks good. Here is what we found:
A maintainer will review your PR within 24–48 hours. Stay responsive to feedback!
|
…vice methods
- Replace per-membership prisma.dailyResult loops in getDashboard and
getTodayStatus with two bulk queries using memberId: { in: memberIds }
- Add getBulkTodayResults() and getBulkMemberDailyResults() service methods
that fetch all results in one query and return maps keyed by memberId
- Add normaliseToMidnight() helper to centralise date normalisation logic
- Group results in-memory via reduce for O(1) controller-level lookup
- Add normaliseToMidnight() helper to centralise date normalisation logic
- Fixes 30+ DB queries per request (15 challenges) down to 3 queries for
getDashboard and 2 for getTodayStatus
Closes gdg-charusat#21
- Fix N+1 in getChallengeLeaderboard: replace per-member prisma loop with getBulkAllMemberResults() which fetches all dailyResult rows for all members in one query (selecting only memberId + completed) and aggregates totalDays/completedDays in-memory - Use normaliseToMidnight() in getTodayStatus service function instead of inline setHours pattern, consistent with new helper convention - Export getBulkAllMemberResults from evaluation.service.js
- Created `prisma/seed.js` to seed the database with sample users, problems, challenges, memberships, daily results, and penalty ledger entries. - Updated `package.json` to include seed scripts for easy execution. - Added `Postman_Collection.json` for API endpoints testing, including health checks, authentication, challenge management, dashboard analytics, and LeetCode integration. - Introduced `postman_environment.json` for environment variable management in Postman. - Documented the seeding and testing process in `SEEDING_AND_TESTING.md` for user guidance. - Created `postman/postman_README.md` to provide an overview of Postman files and quick start instructions.
Contributor
|
@tarun-baranwal can you please remove package-lock.json from the commit and rebase it. thankyou |
Contributor
🎉 PR Merged — Points Awarded!Congratulations @tarun-baranwal! Your contribution has been merged.
The central leaderboard has been updated. Keep contributing!
|
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.
Team Number : Team 113
Description
This PR implements the Submission Analytics Dashboard for admins as described in issue #46.
Related Issue
Closes #46
Type of Change
Added API endpoints to fetch submission analytics:
Number of submissions per day
Average pass/fail rate per challenge
Challenges with the highest fail rates
Updated Prisma schema and migrations to support analytics queries
Updated backend services for computing analytics data
Optional: Ready for visual graphs integration on the frontend
Minor fixes in auth service and Prisma relations
Changes Made:
Prisma Schema Updates
Added DailySubmission relations in prisma/schema.prisma to properly link User and Challenge.
Fixed missing opposite relation fields to resolve Prisma validation errors.
Ensured DailySubmission, User, and Challenge models have correct @relation mappings.
Authentication Service Fixes
Updated auth.service.js for proper registration and login after schema changes.
Verified that getProfile and updateProfile endpoints function as expected.
Admin Analytics Implementation
Created admin.controller.js and admin.service.js to provide submission analytics for admins.
Other Fixes and Improvements
Updated migrations to fix existing database schema issues.
Cleared test user data and ensured DB consistency.
Updated .env handling for smooth local development.
Screenshots (if applicable)
Before:
After:


Testing
npm run build)Checklist
Additional Notes