Skip to content

Feature/inactivity analysis#207

Merged
jagdish-15 merged 10 commits into
codepvg:mainfrom
Yashaswini-K-P:feature/inactivity-analysis
Jun 19, 2026
Merged

Feature/inactivity analysis#207
jagdish-15 merged 10 commits into
codepvg:mainfrom
Yashaswini-K-P:feature/inactivity-analysis

Conversation

@Yashaswini-K-P

Copy link
Copy Markdown
Contributor

Description

Explained in detail in issue

Linked Issue

Fixes #175

Changes Made

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

@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.

This should not run only once per day as discussed here.

Also, please include users with no submission history in the skip list as well. Since they haven't solved any questions yet, they're effectively in the same category as users who have been inactive for 3+ months, and we should avoid making unnecessary API requests for them too.

Comment thread scripts/analyze-inactivity.js Outdated
Comment on lines +45 to +48
if (!user.totalSolved || user.totalSolved === 0) {
inactiveUsers.push(username);
continue;
}

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.

Suggested change
if (!user.totalSolved || user.totalSolved === 0) {
inactiveUsers.push(username);
continue;
}

This has to go for a couple of reasons.

First, this would currently flag every user as inactive because totalSolved is not a top-level field in overall.json user objects. The value is stored under data.totalSolved.

More importantly, the goal of the inactive-user logic isn't just to mark users as inactive. It's also to allow them to become active again once they start solving problems.

With this implementation, users with 0 solved problems are immediately skipped and added to the inactive list. Once they're in that list, the sync script stops fetching their latest state, which means it will never detect that they've solved a problem later.

As a result, a user who starts with 0 solves would effectively remain inactive forever, because there's no mechanism left that can observe them becoming active again.

Comment thread scripts/analyze-inactivity.js Outdated
Comment on lines +25 to +32
const overallFilePath = path.join(DATA_DIR, "overall.json");
let users = [];
try {
const rawData = fs.readFileSync(overallFilePath, "utf8");
users = JSON.parse(rawData);
console.log(`Loaded ${users.length} users from overall.json`);
} catch (err) {
console.error("Failed to load overall.json: ", err.message);

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.

Also, loading the list of users from users.json would be more appropriate than loading it from overall.json

@Yashaswini-K-P

Copy link
Copy Markdown
Contributor Author

Hey @jagdish-15 Updated the inactivity script. It now syncs directly from the original users.json file and handles live API profile validation cleanly. This eliminates the data path bug and ensures 0-solve or inactive users have a daily mechanism to wake up automatically. Tested it locally against our real dataset and it works flawlessly. Let me know if it looks good to merge!
Screenshot 2026-06-18 212558
"Hope it works smoothly in production now! 🤞 (Tested it locally with our real data snapshot and the logs looked perfect!)"

Comment thread scripts/analyze-inactivity.js Outdated
Removed inactive user check based on solved questions.
@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.

@Yashaswini-K-P

Copy link
Copy Markdown
Contributor Author

"Ah, my bad! I was so focused on making sure we caught the 0-solve users to fix that permanent bypass trap that I blindly added the explicit check without realizing the existing calendar timestamp logic already cleanly handles them under the hood.

Great catch! I've removed that redundant block so it's much cleaner now. Committed and pushed."

@jagdish-15

Copy link
Copy Markdown
Collaborator

No worries!

The test run was successful
We're pretty much ready to merge. Could you also remove the emojis that seem to have been recently added to the logs?

@jagdish-15 jagdish-15 added type:feature New feature or request level:advanced Indicates the difficulty gssoc:approved labels Jun 19, 2026
@jagdish-15 jagdish-15 merged commit 6a15d3f into codepvg:main Jun 19, 2026
1 check passed
@Yashaswini-K-P Yashaswini-K-P deleted the feature/inactivity-analysis branch June 19, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved level:advanced Indicates the difficulty type:feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Add Inactivity Metadata Tracking

2 participants