-
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
Humera fix x hours in x weeks streak badges #1208
base: development
Are you sure you want to change the base?
Humera fix x hours in x weeks streak badges #1208
Conversation
Backend Release to Main [2.08]
Backend Release to Main [2.09]
Backend Release to Main [2.10]
Backend Release to Main [2.11]
Revert "Backend Release to Main [2.11]"
…202-development Revert "Revert "Backend Release to Main [2.11]""
Backend Release to Main [2.12]
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.
Tested the following using latest frontend PR and backend PR#1208.
[30]: 30 hours in 1 week
[30, 30] (30 hours in 2 weeks):
30 hours in 1 week drops off
30 hours in 2 weeks assigns and displays
[30,30,30] (30 hours in 3 weeks):
30 hours in 2 weeks drops off (frontend: featured badges)
30 hours in 3 weeks assigns and displays
note: A 2-week streak is not present in DB.
[30,30,30,30] (30 hours in 4 weeks):
30 hours in 3 weeks doesn’t drop off (frontend: featured badges)
30 hours in 4 weeks assigns and displays
[30,30,30, 30,30,30] (30 hours in 6 weeks):
- 30 hours in 3 weeks doesn’t drop off (frontend: featured badges)
- 30 hours in 4 weeks doesn’t drop off (frontend: featured badges)
- 30 hours in 6 weeks assigns and displays
The above test was done for 40 hours as well, and achieved the same results.
Previous weeks should drop off if they are in a consecutive week. In this case, these are consecutive weeks. Please fix this.
Note: I edited cronjob to run per minute to test this. I also modified the following line in userHelper.js to test this.
const users = await userProfile.find({ email: '[email protected]' }).populate('badgeCollection.badge');
Please remove comments made for testing purposes, this should be removed before the merge.
Note: I did not test the entire range of streaks.
Please re-test the following streaks for this issue:
for 30 and 40 hours:
streak 2 weeks in a row
streak 3 weeks in a row
streak 4 weeks in a row
streak 6 weeks in a row
streak 10 weeks
streak 15 weeks
streak 20 weeks
streak 40 weeks
streak 60 weeks
streak 80 weeks
streak 100 weeks
streak 150 weeks
streak 200 weeks
for 50 and 60 hours:
2 weeks in a row
3 weeks in a row
4 weeks in a row
6 weeks in a row
I think the instructions for Step 8 and Step 9 could be clearer to make them easier for someone new to the project to follow. Here’s a summary of what I followed:
Below are my test cases, I'm a bit confused about why the 1-week streak is not being replaced: |
Description
This PR fixes the issue where users weren't receiving the correct streak badges. The system now tracks and awards badges for completing the correct number of hours over consecutive weeks.
Bug : Users were not receiving the streak badges correctly for meeting the hourly targets over multiple weeks.
Fix: Adjusted logic to award badges based on the consecutive streak of hours.
Related PRS (if any):
None
Main changes explained:
##How to test:
10.Using postman to make request GET http://localhost:4500/api/badge/awardBadgesTest, and include Authorization: your-token in the header.
11. In MongoDB Compass, go to userProfiles, find your email, and update the savedTangibleHrs to [30, 30, 30, 40, 40, 40].
12. Use Postman to send the request and verify if the badge is awarded based on the correct streak.
13. go to HGN account->view Profile->Feature Badges
##Test Cases:
##Screenshots or videos of changes:
video1550111681.mp4