-
Notifications
You must be signed in to change notification settings - Fork 29
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
Roberto fix assigning duplicate badges #666
Roberto fix assigning duplicate badges #666
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.
Hi, @robertoooc ,
This is a great solution for the issue of having duplicate badges and no real logic to handle this case! Your solution is elegant and works correctly according to my testing. Your code for the fillEarnedDateToMatchCount()
function works well too. In my testing demonstration, I had two duplicate badges with multiple different earned dates. And after the two duplicate badges merge into one badge, all the earned dates are present and sorted in order. Great job!
fix.assigning.duplicate.badges.earned.dates.correct.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.
I reviewed the functionality and the code changes and everything works well!
Reproduced the issue by editing badge UUID in Compass:
Assigned a new badge of a different kind on the front end:
The duplicates are now grouped together:
I then reproduced the problem again and tested if changing the badge count groups the badges:
The duplicate badges are grouped together!
Very good, clean code! fillEarnedDateToMatchCount is now much more robust and the overall logic of combining "earnedDate" is now easier to follow
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.
Hi @robertoooc,
Excellent work on implementing the new feature! I've thoroughly reviewed your code and can confirm that the changes are functioning as intended. Keep up the good work!
HGNRest_PR.666.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.
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.
Hi @robertoooc, i reviewed your application and it's correct, nice.
2024-01-26-04-52-48.mov
Hi Roberto, I reviewed your badge feature on the front end and it looks great! working properly please reference video: PR.666.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.
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.
Hi @robertoooc,
I've tested the PR you submitted, and I'm pleased to report that it runs smoothly and the code is efficient. My testing procedure involved the following steps: I used an admin account to change the badge of a volunteer account; then, in MongoDB Compass, I modified the badge to be the same as another; upon refreshing, all identical badges were successfully merged. Additionally, I observed that adding a badge also results in the merging of identical badges. Well done on implementing this feature.
BE-666-result.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.
Review
I've reviewed the code in src/controllers/badgeController.js
and tested through the front end as well as MongoDB Compass. The changes are functioning correctly.
Videos:
Splitting duplicate badge dates through MongoDB:
00_split_duplicate_MongoDB.mov
Creating duplicate badge dates through MongoDB:
01_duplicate_MongoDB.mov
Creating duplicate badge as front-end admin:
02_duplicate_front-end.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.
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.
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.
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.
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.
duplicate_badge.mp4
I reviewed the functionality and it works well.
When adding new badges the duplicate badge created via Compass gets merged.
However assigning a new same type of badge from the frontend again, might give a wrong count (as shown in the video). It shows one extra badge when adding the same badge, after changing directly in database.
@Weiyao-Li, I've tried compiling my code with the same command but don't face that issue at all. |
@PratimaSingh02, nice catch! Seems like some new FE changes may have caused this problem. |
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.
Hi @robertoooc . Nice work. Your code seems clean and well written. I have some questions regarding the behavior (since there could be other alternative flows in the bagde assigning process). I have attached a video with related questions about how the webpage should behave in different scenarions. Overall, I really like the simplicity of your code, it was very easy to follow along.
screen-recording-2024-03-01-at-90140-am_6gPihOV5.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.
The merge functionality seems to be working great except the wrong count that shows up when adding the same type of badges. Approving the change as new PR has been created for the same.
Thank you all, moving to final review. |
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.
Great work, I went through your code and didn't found any code smells. Check out the last comment I left for the video
@DiegoSalas27, to clarify any doubts mentioned in your video: |
Got it. Thank you for clarifying that. |
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.
Hi Roberto, it worked as intended. Great job!
HGN.APP.-.Google.Chrome.2024-03-13.18-08-51.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.
Works as described - duplicate badges are grouped together.
- User with assigned badges:
![1](https://private-user-images.githubusercontent.com/107726913/313231867-68844a77-eebb-419f-b5ee-6ea9d463e802.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjY4NzEsIm5iZiI6MTczOTEyNjU3MSwicGF0aCI6Ii8xMDc3MjY5MTMvMzEzMjMxODY3LTY4ODQ0YTc3LWVlYmItNDE5Zi1iNWVlLTZlYTlkNDYzZTgwMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxODQyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wZTBmMGExM2I1YTVkZWVjYmVmNGI1ZTZlNzk1NDBiZmZkYzkwNTFmYjk5MWJkMTAyZjcwMmQwODBlNmZjY2VkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.GPIv3hSEi_5LoAarUYsmZepy3LNViKe1b6H56gP1nUE)
- Added a duplicate badge to this user and the badges are grouped:
![2](https://private-user-images.githubusercontent.com/107726913/313232064-4264b8dd-c685-475d-8e7f-47e81c5400fb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjY4NzEsIm5iZiI6MTczOTEyNjU3MSwicGF0aCI6Ii8xMDc3MjY5MTMvMzEzMjMyMDY0LTQyNjRiOGRkLWM2ODUtNDc1ZC04ZTdmLTQ3ZTgxYzU0MDBmYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxODQyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04YjlhZTBhYjRkYjQyYmZiOGE2MTRlNGU5OWVhZDFjZmU3YzY5ODRiZDU3NGFmNDg5NTdjMGVkNjk0ZTZhMTQzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.QtvIj07vnKH2WhXqm-61mGEghJ_f722DqU_kCFTCzWM)
- The issue dates of duplicates are displayed correctly:
![3](https://private-user-images.githubusercontent.com/107726913/313232306-7c4230e2-005a-4e49-a74a-e01617737173.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjY4NzEsIm5iZiI6MTczOTEyNjU3MSwicGF0aCI6Ii8xMDc3MjY5MTMvMzEzMjMyMzA2LTdjNDIzMGUyLTAwNWEtNGU0OS1hNzRhLWUwMTYxNzczNzE3My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxODQyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NmI0OGYwMTJmZjFlYTkyYzdhMzU2OTc5MzExZGQxMjZhYjA5NDI4ZjVjN2U1NjEyNGI4MzJkZDBhYjcyODQ1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.d9EIA8TqNcQWpxBEjPPgQcE7VtcYKLSVMKWf5hGu24Y)
4.Incremented count, duplicate badges are grouped together and the count is correct:
![4](https://private-user-images.githubusercontent.com/107726913/313232944-feba18fa-6984-4fce-9941-3c7d9176b5b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjY4NzEsIm5iZiI6MTczOTEyNjU3MSwicGF0aCI6Ii8xMDc3MjY5MTMvMzEzMjMyOTQ0LWZlYmExOGZhLTY5ODQtNGZjZS05OTQxLTNjN2Q5MTc2YjViNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQxODQyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03OTc2ODhkYzk1NzkzZjM2MDI4MDkxMjdiYzlkNTBjYjM1MjYxZjA0YzBkMjE1NDhiMzUwNWQ4NTEwNzc2ZWIzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9._J4-DZjMLWJ7ZHpzcxC0g8w87QygBsKwDjhVYmMsz-c)
Great job!
Thank you all, merging! |
Description
Whenever trying to manually assign badges to a user and duplicate badges are involved there aren't any clear updates being made. There was no logic to handle duplicate badges which would not allow badges to be updated anymore.
Related PRS (if any):
Use latest frontend
Main changes explained:
How to test:
src/controllers/userProfileController.js
, comment out lines579 - 583
. This step is important to clear backend cache, clearing cache through browser won't help when making changes to mongo compass and wanting to see changes immediatelynpm install
andnpm run build && npm start
to run this PR locallyHow.to.force.duplicates.mov
Screenshots or videos of changes:
Fixed.mov
Note:
Make sure to follow step 2, if you make changes to the database through mongo compass, you won't see immediate changes in frontend due to the backend cache still not being renewed