-
Notifications
You must be signed in to change notification settings - Fork 30
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
Anoushka fix most hrs week badge #1150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works perfectly well
video2617219546.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verification
- Most Hours Per Week badge is now correctly assigned!
Screen.Recording.2024-11-21.at.12.55.58.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes works well, most hrs week badge is getting updated as per the fix.
PR.1150.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all, merging! |
Description
The Most hours in a week badge wasn't being awarded correctly and resulted in TypeErrors due to logical errors and lack of error handling in code
Related PRS (if any):
This is a backend PR
Main changes explained:
checkMostHrsWeek
inuserHelper.js
badgeCollection
of the user with maximum hours. Increment badeCount if exists or add new badge…
How to test:
routes/badgeRouter.js
and uncomment line 8controller/badgeController.js
and uncomment line 6, 16,17,18, 348helpers/userHelper.js
and uncomment line 1631 and line 1634 for ease of testing and logging statements.savedTangibleHrs
array item to reflect max hours in a week and also update fieldlastWeekTangibleHrs
with same number of hours.helpers/userHelper.js
and update line 2019 withconst users = await userProfile.find({email: xxx}).populate('badgeCollection.badge');
and comment line 2025,2026,2028-2032 for faster testing.npm install
andnpm run dev
to run this PR locallyhttp://localhost:4500/api/badge/awardBadgesTest
with login authorization token.Badges Awarded
and on terminal you should see the logging statements and no TypeErrors.Screenshots or videos of changes:
Screen.Recording.2024-11-15.232411.mp4
Note:
Include the information the reviewers need to know.