Commit 20e91f2
Default v_usdc_purchases.extra_amount to 0 when price_history is missing
If no track_price_history / album_price_history row applies to a
purchase (e.g., content was deleted before its price was indexed, a
backfilled historical purchase whose price predates the price_history
table, or tests not seeding price_history), the view currently returns
extra_amount = sp.amount because COALESCE falls back to 0 and
(sp.amount - 0) = sp.amount.
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."
This was the third commit on the PR #815 branch that didn't make it
into the squash-merge (alongside the updated_at fix in d578302).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent d578302 commit 20e91f2
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