Skip to content

added non-activity section#178

Open
Yashaswini-K-P wants to merge 8 commits into
codepvg:mainfrom
Yashaswini-K-P:feature/non-competitive-zero-ranks
Open

added non-activity section#178
Yashaswini-K-P wants to merge 8 commits into
codepvg:mainfrom
Yashaswini-K-P:feature/non-competitive-zero-ranks

Conversation

@Yashaswini-K-P

Copy link
Copy Markdown
Contributor

Description

This PR improves the leaderboard experience by resolving arbitrary ranking assignments for users with 0 scores. It handles zero-score behavior differently across tabs to match the terminal-style UI theme and prevent empty layouts:

  • Overall Leaderboard: Completely removes users with an overall score of 0 from the competitive ranks and displays them in a separate "No activity yet" section.
  • Daily/Weekly/Monthly Leaderboards: Keeps zero-score users visible at the bottom to ensure the UI stays active, but omits their rank numbers, replacing them with a non-competitive -- delimiter.

Linked Issue

Fixes #93

Changes Made

  • Excluded users with overall 0 scores from the primary competitive layout.
  • Added a dedicated "No activity yet" block matching the terminal theme at the bottom of the Overall tab.
  • Removed rank numbers for zero-score users in time-based tabs (Daily, Weekly, Monthly) and replaced them with --.
  • Integrated changes with existing pagination, filtering/search logic, and mobile layouts.

Type of Change

  • Bug fix
  • New feature
  • UI/Visual update
  • Documentation update
  • Refactor

Testing

  • Tested locally
  • Tested on mobile viewport (if applicable)
  • No console errors introduced

Checklist

  • My code follows the project's coding style
  • I have formatted my code locally by running npx prettier --write . before submitting
  • I am submitting my PR from a dedicated feature/* branch, not the main branch
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have updated documentation if required
  • I have linked the relevant issue

Screenshots / Screen Recording

Overall Tab Example:

1. UserA (100 pts)
2. UserB (80 pts)
───────────────────
-- InactiveUser1 (No activity yet)
-- InactiveUser2 (No activity yet)

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for submitting a pull request.

Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully.

Formatting and Branching

  • Please confirm you have formatted your code locally using npx prettier --write ., or you can simply comment /format on this PR to have our bot do it for you!
  • Ensure this PR is made from a feature/* branch and not main.

Note: This project is currently maintained by a solo maintainer, so reviews and responses may sometimes take a little time. Thanks for your patience.

@jagdish-15 jagdish-15 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've tested the changes locally and the implementation looks good overall, especially the separate non-activity section in the Overall leaderboard.

There are just a couple of behavior adjustments I'd still like before merging:

  • The separate "No activity yet" section shouldn't exist only in the Overall tab. Since the same never-active users are present across all leaderboard datasets, this section should appear consistently across Daily/Weekly/Monthly as well.

  • The -- non-competitive rank placeholder behavior was mainly intended for users who temporarily have a 0 score in a specific timeframe leaderboard, but still have activity/score in the Overall leaderboard. In other words:

    • users with no activity at all → move to the separate non-activity section,
    • users active overall but currently 0 in Daily/Weekly/Monthly → keep in the normal leaderboard flow with -- instead of a rank.
  • In the stats section:

    Total Users: 90 | Showing: 26-50 | Page: 2/4
    

    I'd still prefer Total Users to represent the complete registered leaderboard size rather than only active users.

    For example, if there are 107 total users and 17 are never-active users, I think the count should still display 107 instead of 90 since those users are still searchable and still rendered later in the page under the non-activity section.

@Yashaswini-K-P

Copy link
Copy Markdown
Contributor Author

/format

@github-actions

Copy link
Copy Markdown
Contributor

I have successfully run Prettier and pushed the formatting fixes to this PR.

Note for Contributors: Because this commit was pushed by a bot, GitHub will not automatically re-run the CI checks. To trigger them to pass, you must either:

  • Push an empty commit locally (git commit --allow-empty -m "Trigger builds" and push)
  • Close and immediately reopen this Pull Request.

@jagdish-15 jagdish-15 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've added a few changes to improve the mobile view of the leaderboard after adding this feature, and everything looks good now.

My only concern at this point is the sync script changes, since I don't think those are really required here, the frontend is already handling this behaviour correctly on its own

Comment on lines +37 to +43
if (sortedData[i].score === 0) {
sortedData[i].originalRank = "--";
} else {
if (i > 0 && sortedData[i].score < sortedData[i - 1].score) {
currentRank = i + 1;
}
sortedData[i].originalRank = currentRank;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since the frontend is already handling this, I don't think adding the same logic again inside the sync script is really necessary

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.

Issue: Improve Handling of Users with Zero Score in Leaderboard Ranking

2 participants