Skip to content
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

Fix personal max record badge #1193

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

skaush21
Copy link
Contributor

@skaush21 skaush21 commented Jan 3, 2025

Description

Screen Shot 2025-01-02 at 3 45 53 PM

Fixes:

  1. Based on the current design documentation and schema, updated the Data Source to merge Time Entries and savedTangibleHrs to get an accurate reading on the personal best max hour.
  2. Modified a date format that fixed the earned dates that were not being added.

Related PRS (if any):

Related backend PR: PR #947
To test this PR use frontend development.

Main changes explained:

  • Fixed formatting issue, that was causing earnedDates to be inaccurate.
  • optimized code, improved clarity, and reduced overhead calls.
  • added a merge function to merge Time Entries and user.savedTangibleHrs
  • cleaned up the code from debugging and uncommented the functioning code.

How to test:

  1. check into the current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. log in as admin user
  5. go to dashboard→ Add Time via Add intangible Time Entry
  • Use Postman to initiate a request
  • Navigate to dashboard -> view Profile -> Featured Badges
  • Verify that the New Personal Max Record Badge icon contains the current max hour
    Note: earnedDate will showcase the current date (Sunday) and not the previous dates, this is because user.savedTangibleHrs does not have any dates associated with its hours, whereas Time Entries does. Due to this, previous dates are not accounted for.
  • add hours via userProfile -> savedTangibleHrs using MongoDB.
  • Use Postman to send requests and verify in the front end that the personal best max hour has been updated with the new hour. Note: The personal best max hour takes the max hour overall weeks. Any hour added must be higher than any previous week.
  • Additionally, verify that the badge appears in the badgeCollection using MongoDB. To do this, navigate to userProfile -> badgeCollection -> Object. Copy the badge ID within the Object and open a separate tab for the badges folder. Use the following in the search and paste the badge ID within the quotations. { _id: ObjectId("666b78265bca0bcb94080605") }.

Screenshots or videos of changes:

Modify the backend with the following to test this PR:

327992191-a51b8597-35f7-4f28-a7c7-304539c3538c 327982279-4df5dd7a-0773-420a-b741-169966447fd6 327981826-24ca6538-6e9f-4af9-ba93-9314e454b782 327981812-431822cc-dd15-467a-8bc1-664a9c6a4bae 327981804-c3aa9a18-e29f-4e00-9c93-d1050d7f5aa7

Verify

Screen Shot 2025-01-02 at 5 23 02 PM Screen Shot 2025-01-02 at 5 23 15 PM Screen Shot 2025-01-02 at 5 24 52 PM

Note:

Will need to use Postman to POST and GET requests and MongoDB to update savedTangibleHrs and verify that the badge collection has the badge.

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Jan 3, 2025
Copy link

@kobakvantrishvili kobakvantrishvili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me how to test this PR. I don't know where exactly to modify the backend code and I'm also not sure what HTTP request I should send out. More clarity or a video demonstration would be good. I have no complaints with the actual code that's modified as it makes sense and is readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants