add optional anchor time to runs [#186531175] #625
Merged
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.
Contributing to the Donation Tracker
Issue from Pivotal Tracker
https://www.pivotaltracker.com/story/show/186531175
Description of the Change
This set of changes allows you to set a fixed start time for a given run. It will adjust the
setup_time
for the immediately preceding run to make sure that the start time is always where you set, or if it is not possible to do so, model validation will fail and whatever change you're trying to perform will not actually occur.There's several touchpoints where this validation needs to kick in, for example moving a run required some changes because of new validation requirements. While looking for edge cases I discovered one that I'm not sure can easily be reconciled, so for now, you will get an error if you try and move a run directly before an anchored run (because the flex block is suddenly in a different place and I couldn't come up with a good answer for what to do with the old flex block). If you find yourself needing to do this for some reason, the only solution is to remove the anchor time before performing the move. It's possible I'll make this a more explicit error case in the future, but for now it will just fail because the current logic cannot come up with a solution, so the move is prevented.
As part of this, I had to touch up the current schedule editor to display errors that could never occur before, but it was relatively simple to do so.
Verification Process
Attempting to edit runs by hand in the admin, or via the schedule editor, ensuring that flex blocks would either error or end up with the expected values.