Prevent overlaps in quick-entry and validate max capacity in a day - #6192
Open
IvanRublev wants to merge 1 commit into
Open
IvanRublev wants to merge 1 commit into
IvanRublev wants to merge 1 commit into
Conversation
…p overlaps Co-authored-by: Kaizero <noreply@kaizero.sh>
Member
|
Thanks. |
Author
Hi @kevinpapst thanks for your comment. I'm sorry for pushing the PR without a consensus about the new functionality. Happy to join the discussion. |
6 tasks
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.
Description
Fixes #5348: Quick entry gave every row of a day the same configured default start
time and saved the resulting overlaps, even though overlapping records are forbidden.
Root cause:
QuickEntryControllerstamped every new grid row for every day with thesame default begin time, and the existing
TimesheetOverlappingper-row constraintonly queries already-persisted records — it cannot see the other unsaved rows in the
same grid submission, so an overlap created inside one submission was invisible.
Fix: a new
App\Validator\Constraints\QuickEntryWeekclass-level constraint (with itsQuickEntryWeekValidator), wired intoQuickEntryForm, that for each user/day groupin a quick-entry submission:
(
TimesheetRepository::findForDay(), including a still-running timer that began anearlier day);
single-entry form uses when a running timer would otherwise be silently overlapped;
actual DST-aware length, or whose chained end would cross midnight, naming the day
(new
translations/validators.en.xlfentry).Existing (already-persisted) rows are never repositioned or checked against each other,
so a pre-existing overlapping pair remains editable without one side blocking the other.
allow_overlapping_records = 1installations see no behavioural change beyond the newday-capacity limit.
TimesheetService::updateMultipleTimesheets()and thesingle-entry/API paths are untouched.
Types of changes
Checklist
composer code-check: codestyle,phpstan level 9, linting all exit 0)
How this was verified
tests/Validator/Constraints/QuickEntryWeekValidatorTest.php(19 cases —chaining, day-sum boundaries, DST spring-forward/fall-back, running-timer block
(same-day and begun-the-day-before),
allow_overlapping_records=1bypass, clearedduration, existing-overlapping-pair tolerance, multi-user isolation, translation
domain wiring),
tests/Repository/TimesheetRepositoryTest.php(newfindForDay()coverage),
tests/Controller/QuickEntryControllerTest.php(end-to-end reproduction +billing check via real HTTP submission).
tasks/BUG-5348-quick-entry-same-start-time-overlap.md.findForDay()gapfor a still-running timer that began the previous day, a phpstan nullable-call gate
failure in test code, and a missing translation domain on the day-capacity violation
message.
tests/Timesheet/TimesheetServiceTest.php,tests/Validator/Constraints/TimesheetOverlappingValidatorTest.php,tests/Model/QuickEntryWeekTest.php,tests/Model/QuickEntryModelTest.php,tests/Form/Type/QuickEntryTimesheetTypeTest.php,tests/Validator/Constraints/QuickEntryModelValidatorTest.php,tests/Validator/Constraints/QuickEntryTimesheetValidatorTest.php— all green.