Skip to content

Conversation

@angelayu0530
Copy link
Collaborator

@angelayu0530 angelayu0530 commented Jan 28, 2026

663

Description of changes

Checklist before review

  • I have done a thorough self-review of the PR
  • Copilot has reviewed my latest changes, and all comments have been fixed and/or closed.
  • If I have made database changes, I have made sure I followed all the db repo rules listed in the wiki here. (check if no db changes)
  • All tests have passed
  • I have successfully deployed this PR to staging
  • I have done manual QA in both dev (and staging if possible) and attached screenshots below.

Screenshots

Dev

When Alex has 8500 points

Screenshot 2026-01-31 at 5 01 01 PM

When Alex has 0:

Screen.Recording.2026-01-31.at.5.03.08.PM.mov

Staging

@github-actions
Copy link
Contributor

Available PR Commands

  • /ai - Triggers all AI review commands at once
  • /review - AI review of the PR changes
  • /describe - AI-powered description of the PR
  • /improve - AI-powered suggestions
  • /deploy - Deploy to staging

See: https://github.com/tahminator/codebloom/wiki/CI-Commands

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

The command to deploy to staging for the commit 5c4b0a9 has been triggered. View action run

@github-actions
Copy link
Contributor

Title

663: Handle case where 0 point users are given achievements


PR Type

Bug fix, Tests


Description

  • Exclude zero-point users from winners

  • Apply filtering for global and tag leaderboards

  • Add tests covering zero-point exclusions


Diagram Walkthrough

flowchart LR
  A["Fetch ranked users"] -- "filter totalScore > 0" --> B["usersWithPoints"]
  B -- "take top N" --> C["winners"]
  C -- "createAchievement" --> D["AchievementRepository"]
Loading

File Walkthrough

Relevant files
Bug fix
LeaderboardManager.java
Filter out zero-point users before awarding                           

src/main/java/org/patinanetwork/codebloom/common/components/LeaderboardManager.java

  • Filter users to totalScore > 0
  • Apply filter for tag leaderboards
  • Apply filter for global leaderboard
  • Select winners from filtered list
+8/-2     
Tests
LeaderboardManagerTest.java
Tests for zero-point user exclusion                                           

src/test/java/org/patinanetwork/codebloom/common/components/LeaderboardManagerTest.java

  • Add test excluding zero-point users globally
  • Add test excluding zero-point users for tag
  • Verify only valid achievements are created
+65/-0   

@github-actions
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Index Error

Using subList(0, maxWinners(usersWithPoints.size())) can throw IndexOutOfBoundsException if maxWinners returns a value greater than usersWithPoints.size() or negative. Confirm maxWinners clamps to available size and is non-negative.

List<Indexed<UserWithScore>> winners = usersWithPoints.subList(0, maxWinners(usersWithPoints.size()));

for (int i = 0; i < winners.size(); i++) {
    int place = i + 1;
    log.info("on leaderboard for {} for winner #{}", pair.getRight().getResolvedName(), place);
Null Safety

Filtering on getItem().getTotalScore() assumes non-null item and score. Ensure UserWithScore and totalScore are non-null or guard against nulls to avoid NPEs in production.

List<Indexed<UserWithScore>> usersWithPoints = users.stream()
        .filter(indexed -> indexed.getItem().getTotalScore() > 0)
        .toList();

@github-actions
Copy link
Contributor

Staging deployment succeeded for commit 5c4b0a9

View run

@angelayu0530 angelayu0530 force-pushed the fix-achi branch 2 times, most recently from b5c771f to d273630 Compare January 30, 2026 18:29
@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

The command to deploy to staging for the commit d273630 has been triggered. View action run

@github-actions
Copy link
Contributor

Staging deployment was cancelled for commit d273630

View run

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

The command to deploy to staging for the commit d273630 has been triggered. View action run

@github-actions
Copy link
Contributor

Staging deployment succeeded for commit d273630

View run

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

The command to deploy to staging for the commit d273630 has been triggered. View action run

@github-actions
Copy link
Contributor

Staging deployment succeeded for commit d273630

View run

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

The command to deploy to staging for the commit f4746f5 has been triggered. View action run

@github-actions
Copy link
Contributor

Staging deployment succeeded for commit f4746f5

View run

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Commit Validation Failed

The following commits do not start with the required Notion ID 663:

633: Fix DockerFile to install all browsers to fix Bug

Please rebase and update your commit messages.
All messages should be of the following format: 663: Example commit

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

The command to deploy to staging for the commit 9b09554 has been triggered. View action run

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Staging deployment succeeded for commit 9b09554

View run

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

The command to deploy to staging for the commit 5df1025 has been triggered. View action run

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Staging deployment succeeded for commit 5df1025

View run

@angelayu0530
Copy link
Collaborator Author

/deploy

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

The command to deploy to staging for the commit 0f41d5a has been triggered. View action run

@codecov
Copy link

codecov bot commented Feb 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Staging deployment succeeded for commit 0f41d5a

View run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants