Commit 11d2284
fix(purchases): default extra_amount to 0 when price_history is missing
If no track_price_history / album_price_history row applies to a
purchase, the view currently returns extra_amount = sp.amount because
the COALESCE falls back to 0 and (sp.amount - 0) = sp.amount.
Cases this hits:
- Content deleted before its price was ever indexed
- Backfilled historical purchases whose content predates
price_history tracking
- Test environments that don't fixture price_history
Change the fallback to sp.amount so the subtraction nets to 0 —
matches "we don't know the base price, don't claim there was a tip."
Production purchases via the Go indexer always have price_history
coverage (the indexer validates against it), so this only affects the
fallback path.
This was a follow-up commit on the PR #815 branch that didn't make it
into the squash-merge.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent e3eb44f commit 11d2284
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9644 | 9644 | | |
9645 | 9645 | | |
9646 | 9646 | | |
9647 | | - | |
| 9647 | + | |
9648 | 9648 | | |
9649 | 9649 | | |
9650 | 9650 | | |
| |||
0 commit comments