Summary
Add a Conquest Rate metric beside Problem Coverage on the Home dashboard. Conquest Rate should show the percentage of non-deleted problems whose latest known correct/incorrect result is correct.
Background / Context
Issue #305 added the protected Home dashboard with Problem Coverage and a daily activity grid. The Home dashboard now needs a second large-number metric with similar visual treatment: Conquest Rate.
Confirmed product decisions:
Problem Coverage remains # tried problems / # total non-deleted problems.
Conquest Rate means # mastered non-deleted problems / # total non-deleted problems.
- A mastered problem is one whose latest known correct/incorrect result is
correct.
- Pending-review results are ignored for conquest. They still count for coverage and activity, but do not change mastery until resolved.
- The Conquest Rate card should visually sit beside Problem Coverage and have comparable prominence.
Relevant codebase context from issue #305:
- Home API endpoint:
GET /api/v1/home/summary.
- Backend Home route area:
backend/app/presentation/home.py.
- Frontend Home page:
frontend/src/pages/HomePage.tsx.
- Existing Home tests:
backend/tests/api/test_home.py and frontend/src/pages/HomePage.test.tsx.
Problem
The Home dashboard currently shows only coverage. Coverage answers whether a problem has been tried, but it does not show how much of the problem set has been conquered/mastered.
Goal / Expected Behavior
The Home dashboard should show two sibling large-number stat cards:
Problem Coverage: tried problems over total problems.
Conquest Rate: mastered problems over total problems.
For zero total problems, Conquest Rate should show 0% with a short zero-state note rather than hiding the metric.
Scope
This issue should cover:
- Extend the Home summary API response with conquest data.
- Compute mastered problems from the latest known correct/incorrect result per problem.
- Ignore pending-review results when deciding mastery.
- Render a Conquest Rate stat card beside Problem Coverage.
- Add backend and frontend tests for the new metric.
Out of Scope
This issue should not cover:
- Changing the existing Problem Coverage formula.
- Changing grading, practice, or exam workflows.
- Adding drill-down views or problem lists behind the metric.
- Changing the activity grid layout or month labels.
- Fixing the dark-theme bottom background issue.
Chosen Implementation Approach
Extend GET /api/v1/home/summary with a conquest object, for example:
conquest.totalProblems
conquest.masteredProblems
conquest.percentage
Use all non-deleted problems owned by the current user as the denominator.
For each non-deleted problem, determine the latest known correct/incorrect event across:
- Practice attempts, using
practice_attempts.createdAt and gradingStatus.
- Submitted exam items, using
exam.submittedAt for the event time and each item’s grading.status / correctness fields.
- Self-reported exam items after submission, using the resolved item grading state when available.
Ignore pending-review events for conquest. If a problem has only pending-review activity and no prior correct/incorrect result, it is not mastered.
Implementation Plan
The implementor should:
- Update the Home summary response model/types to include
conquest.
- Collect relevant practice attempts for the current user and non-deleted problem IDs.
- Collect submitted exams for the current user and inspect their items for correct/incorrect outcomes.
- For each problem, keep only the latest correct/incorrect event by timestamp.
- Count a problem as mastered when that latest known correct/incorrect event is correct.
- Return the conquest totals and rounded percentage alongside existing coverage and activity data.
- Update the Home page to render
Problem Coverage and Conquest Rate as sibling stat cards.
- Preserve existing coverage and activity behavior.
Relevant Files / Areas
Likely relevant areas:
backend/app/presentation/home.py
backend/tests/api/test_home.py
frontend/src/pages/HomePage.tsx
frontend/src/pages/HomePage.test.tsx
Suggested verification commands:
cd backend && uv run pytest backend/tests/api/test_home.py
cd frontend && npm test -- --run HomePage
Tests Required
The implementor must add or update automated tests covering:
- API returns
conquest fields with zero problems.
- Latest correct practice attempt makes a problem mastered.
- Latest incorrect practice attempt makes it not mastered.
- Latest submitted exam correct/incorrect item participates in conquest.
- Pending-review-only activity does not mark a problem mastered.
- Pending-review latest event does not override the latest known correct/incorrect result.
- Deleted problems and other users’ data are excluded.
- Frontend renders the Conquest Rate card beside Problem Coverage.
- Frontend renders zero-state and normal supporting text for conquest.
At minimum, tests should verify:
- The happy path with both coverage and conquest values.
- The pending-review edge case.
- User data isolation.
- That existing Problem Coverage rendering still works.
Manual Verification / Self-Check
Before claiming this issue is done, the implementor must:
- Run the relevant backend Home API tests.
- Run the relevant frontend Home page tests.
- Load the Home page with no problems and verify both metrics show
0% with appropriate notes.
- Create or seed correct and incorrect activity and verify Conquest Rate changes as expected.
- Include exact commands and pass/fail results in the PR description.
Suggested verification commands:
cd backend && uv run pytest backend/tests/api/test_home.py
cd frontend && npm test -- --run HomePage
Reviewer Acceptance Checklist
The reviewer should verify that:
Dependencies
Depends on the Home dashboard from #305 being present in the target branch.
Follow-Up Work
Possible future work, not included here:
- Drill-down list of mastered/unmastered problems.
- Subject/tag-specific conquest metrics.
Definition of Done
This issue is done when:
GET /api/v1/home/summary returns conquest data.
- The Home dashboard displays Conquest Rate beside Problem Coverage.
- Pending-review handling follows the confirmed behavior.
- Required automated tests pass.
- Manual verification is documented in the PR.
Summary
Add a
Conquest Ratemetric besideProblem Coverageon the Home dashboard.Conquest Rateshould show the percentage of non-deleted problems whose latest known correct/incorrect result is correct.Background / Context
Issue #305 added the protected Home dashboard with
Problem Coverageand a daily activity grid. The Home dashboard now needs a second large-number metric with similar visual treatment:Conquest Rate.Confirmed product decisions:
Problem Coverageremains# tried problems / # total non-deleted problems.Conquest Ratemeans# mastered non-deleted problems / # total non-deleted problems.correct.Relevant codebase context from issue #305:
GET /api/v1/home/summary.backend/app/presentation/home.py.frontend/src/pages/HomePage.tsx.backend/tests/api/test_home.pyandfrontend/src/pages/HomePage.test.tsx.Problem
The Home dashboard currently shows only coverage. Coverage answers whether a problem has been tried, but it does not show how much of the problem set has been conquered/mastered.
Goal / Expected Behavior
The Home dashboard should show two sibling large-number stat cards:
Problem Coverage: tried problems over total problems.Conquest Rate: mastered problems over total problems.For zero total problems, Conquest Rate should show
0%with a short zero-state note rather than hiding the metric.Scope
This issue should cover:
Out of Scope
This issue should not cover:
Chosen Implementation Approach
Extend
GET /api/v1/home/summarywith aconquestobject, for example:conquest.totalProblemsconquest.masteredProblemsconquest.percentageUse all non-deleted problems owned by the current user as the denominator.
For each non-deleted problem, determine the latest known correct/incorrect event across:
practice_attempts.createdAtandgradingStatus.exam.submittedAtfor the event time and each item’sgrading.status/ correctness fields.Ignore pending-review events for conquest. If a problem has only pending-review activity and no prior correct/incorrect result, it is not mastered.
Implementation Plan
The implementor should:
conquest.Problem CoverageandConquest Rateas sibling stat cards.Relevant Files / Areas
Likely relevant areas:
backend/app/presentation/home.pybackend/tests/api/test_home.pyfrontend/src/pages/HomePage.tsxfrontend/src/pages/HomePage.test.tsxSuggested verification commands:
Tests Required
The implementor must add or update automated tests covering:
conquestfields with zero problems.At minimum, tests should verify:
Manual Verification / Self-Check
Before claiming this issue is done, the implementor must:
0%with appropriate notes.Suggested verification commands:
Reviewer Acceptance Checklist
The reviewer should verify that:
Dependencies
Depends on the Home dashboard from #305 being present in the target branch.
Follow-Up Work
Possible future work, not included here:
Definition of Done
This issue is done when:
GET /api/v1/home/summaryreturns conquest data.