[Badges] The system creates too many `BadgeProgress` records per learner that floods DB
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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