Fix budgets for categories missing from snapshots - #416
Merged
otherworld-dev merged 1 commit intoOct 3, 2026
Merged
otherworld-dev merged 1 commit into
otherworld-dev merged 1 commit into
Conversation
otherworld-dev
added a commit
that referenced
this pull request
Oct 3, 2026
The fix in #416 added the missing row with its own fallbacks for the amount and period, which differed from resolveEffectiveBudget(), so a period-only save could turn an earlier "no budget" into the category's default, and a NULL period was stored as the category's own rather than monthly. The row now starts from resolveEffectiveBudget() and the change is applied to it like any other row. Two quick saves that both find no row no longer show the user a unique index error, as the second updates the row the first one added, and an unknown category keeps the readable "No budget snapshot found" message rather than the mapper's SQL. A save with nothing to change is refused instead of writing a row. The changelog now gives the real cause, a category created after the adjustment was made.
otherworld-dev
added a commit
that referenced
this pull request
Oct 3, 2026
Contributed by @almeidandres, with follow-up fixes.
Owner
|
Merged with a few changes on top. The new row now starts from the budget the page was already showing for that month, so a period-only save keeps an earlier "no budget" instead of picking up the category's default. Two quick saves that both miss the row no longer show the user the unique index error, and an unknown category keeps the "No budget snapshot found" message rather than the SQL from the mapper. I also reworded the changelog, the adjustment copies every category including excluded ones, so the missing row only happens for a category created after the adjustment was made. Thanks for the fix and the test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A category excluded when a monthly budget snapshot was created has no row in that snapshot. Re-enabling the category and setting its budget then returns “No budget snapshot found for this category and month”.
Fix
Insert a snapshot row when the month already contains snapshot rows but the requested owned category does not. The new row uses the submitted values and falls back to the category's effective budget for omitted fields. Existing rows remain unchanged.
Checks
CategoryServiceTest: 66 tests, 158 assertionsCategoryService.php