Skip to content

Keep the documents of earlier occurrences when a recurring expense repeats - #666

Merged
scastiel merged 1 commit into
spliit-app:mainfrom
VincentBorgers:fix/recurring-expense-documents
Oct 10, 2026
Merged

scastiel merged 1 commit into
spliit-app:mainfrom
VincentBorgers:fix/recurring-expense-documents

Conversation

@VincentBorgers

Copy link
Copy Markdown
Contributor

Summary

  • When a recurring expense with documents creates its next occurrence, createRecurringExpenses() connects the existing ExpenseDocument rows to the new expense. A document belongs to one expense, so this moves it. The receipt disappears from the expense it was uploaded for and from every earlier occurrence, and only the latest occurrence keeps it.
  • The new occurrence now gets its own document rows with the same URL and size, the same way createExpense() stores documents.

Before / After

A daily expense with one receipt, started three days ago.

Before After
Only the latest occurrence has a document Every occurrence has a document

Test plan

  • src/lib/api.test.ts fails on main (the new occurrence connects document-1) and passes with this change.
  • Against Postgres, I seeded the expense above and loaded the group's expenses. On main only the latest of the four occurrences has a document, with this change all four do.
  • npm test, npm run check-types, npm run lint (no new warnings) and npm run check-formatting pass.

@scastiel
scastiel merged commit 77f053a into spliit-app:main Oct 10, 2026
3 checks passed
@scastiel

Copy link
Copy Markdown
Member

Thanks @VincentBorgers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants