LCFS - Compliance report approval not refreshing `mv_credit_ledger` materialized view
- Dominant language
- Python
- Stars
- 6
- Forks
- 6
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 87
Description
**Describe the Bug**
When a compliance report is approved, the `mv_credit_ledger` materialized view is not being refreshed. The underlying data changes on approval, but the view continues to serve stale credit ledger data until it's manually refreshed.
**Expected Behaviour**
Approving a compliance report should trigger a refresh of the `mv_credit_ledger` materialized view so downstream queries reflect the post-approval credit state immediately.
**Actual Behaviour**
The approval completes successfully and the underlying tables update, but `mv_credit_ledger` is not refreshed as part of the approval flow. Queries against the view return stale balances until the view is refreshed out-of-band.
**Implications**
Credit balances shown to users and used in downstream compliance calculations are stale after an approval. This risks incorrect balance displays, incorrect validation against available credits on subsequent transactions, and potential reporting discrepancies for audit and compliance purposes.
**Steps To Reproduce**
User/Role: Director (or any role with compliance report approval permissions)
1. Go to the Compliance Reports page
2. Open a compliance report that is in the state prior to final approval
3. Click the approve action to record the director/final approval
4. Query `mv_credit_ledger` (or view a screen backed by it) for the affected organization
5. See that the ledger does not reflect the credits issued/adjusted by the approval until the materialized view is manually refreshed
Contributor guide
Assessment
This issue has not been assessed yet.