Skip to content

Issue: Prevent Duplicate or Misaligned Entries in User Profile History Arrays #399

Description

@Yashaswini-K-P

File Name

scripts/sync-leaderboard.js

Problem

In updateUserDataAsync, the history update checks for existing entries using dateStr (YYYY-MM-DD). However, if the sync script runs multiple times across different time zones or if historical file indexing shifts due to timing discrepancies, multiple entries for the same date can occasionally be created or overwrite issues occur without robust deduplication.

Proposed Solution

Strengthen the history entry check by ensuring strict uniqueness based on date and adding a validation filter before sorting to eliminate duplicate entries for the same calendar date.

Implementation Details

  • Deduplication Logic: Before writing the updated history array back to disk, filter out or consolidate duplicate entries matching the same date string:
    const uniqueHistory = Array.from(
      new Map(history.map(item => [item.date, item])).values()
    );

Activity

  1. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

    Thank you for opening an issue.

    Please review our CONTRIBUTING.md guidelines before getting started.

    A maintainer will review this issue shortly. If you would like to work on the issue yourself, please leave a comment requesting assignment.

    Issue Assignment Policy

    • The issue creator is given the first priority to work on their issue.
    • If the creator declines or does not request assignment, the issue will be assigned to others in the order of requests received.
    • Please do not submit PRs or begin work until you are officially assigned.

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

  2. aaniya22 commented on Aug 6, 2026

    @aaniya22
    Contributor

    pls assign this to me under gssoc

  3. github-actions commented on Aug 23, 2026

    @github-actions
    Contributor

    This issue has been inactive for 14 days and has been marked as stale. To keep this issue open, please leave a comment.

  4. Yashaswini-K-P commented on Aug 29, 2026

    @Yashaswini-K-P
    ContributorAuthor

    working

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

Metadata

Metadata

Labels

BackendTask mainly involving backendtype:bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions