Skip to content

fix(goals): validate add-goal and mark invalid goals - #357

Merged
Martin-1997 merged 1 commit into
masterfrom
fix/goals-invalid-interval
Nov 22, 2026
Merged

Martin-1997 merged 1 commit into
masterfrom
fix/goals-invalid-interval

Conversation

@Martin-1997

@Martin-1997 Martin-1997 commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #356

  • add-goal rejects intervals other than Weekly/Monthly and hours that aren't a whole number of at least 1.
  • get-goals returns goals with an invalid interval or hours with "invalid": true and zero figures, instead of PHP warnings and the previous goal's figures. Valid goals get "invalid": false.
  • Goals view: an invalid goal shows "This goal has no valid interval/hours. Please delete it and add it again." in place of the figures.

The database columns are NOT NULL, so goals without a project, hours or interval can't exist. Invalid values could only come in through the API.

Tests: new tests/Integration/Controller/GoalsTest.php. It fails on master (Undefined variable $intervals) and passes with the fix. The full integration suite passes (50 tests), as do the unit tests and phpstan. Checked in the browser on Nextcloud 31.

🤖 Generated with Claude Code

… or hours

add-goal accepted any interval and hours. A goal with an interval other
than Weekly/Monthly made get-goals use an undefined variable (PHP warnings)
and reuse the figures of the previous goal. Such goals are now returned
with "invalid": true and zero figures, the Goals view asks to delete and
re-add them, and add-goal rejects invalid intervals and hours below 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Martin-1997 added a commit that referenced this pull request Nov 22, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Martin-1997 Martin-1997 mentioned this pull request Nov 22, 2026
@Martin-1997
Martin-1997 merged commit 3584b79 into master Nov 22, 2026
20 checks passed
Martin-1997 added a commit that referenced this pull request Nov 22, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Martin-1997 added a commit that referenced this pull request Nov 22, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Goals with an invalid interval or hours break the goal list

1 participant