openedx / openedx/credentials

[Badges] The system creates too many `BadgeProgress` records per learner that floods DB

Open
#2,985 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
25
Forks
83
Avg merge
11h 51m
Merged PRs (30d)
1

Description

Description

The current badge processing flow creates BadgeProgress records while checking whether a learner has already completed a badge template.

As a result, the system can create progress rows even when the learner has not actually fulfilled any requirement. This likely explains how a deployment can issue relatively few badges while still accumulating a very large number of badge progress records.

Supporting Info

BadgeProgress uses the get_or_create() method in each process_requirements() check.
There is also a second path through grouped requirement checks that can create progress records during evaluation.

Expected Result

BadgeProgress records should be created only when a learner actually earns or loses progress toward a badge.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the badge processing flow through each process_requirements() check and the grouped requirement path, focusing on their get_or_create() calls for BadgeProgress. Reproduce evaluation for a learner who has not fulfilled a requirement and inspect whether rows are created. Done means progress records are created only when a learner earns or loses badge progress, with coverage for both paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.