Colour baseline bars by duration, and draw one when only the duration changed - #2846
Closed
Natalie-the-technician wants to merge 1 commit into
Closed
Natalie-the-technician wants to merge 1 commit into
Natalie-the-technician wants to merge 1 commit into
Conversation
The comparison between a task and its baseline was made on end dates only, and two things followed from that. A task whose end date did not move got no baseline bar at all. A task which starts earlier and ends on the same day therefore takes longer than in the baseline and is the one task which shows nothing, while its neighbours show two bars each. The colour was chosen by the end date, so a task which was merely moved got the same colour as a task which grew. A baseline bar is now drawn whenever the task moved or its duration changed, and the colour follows the duration: a task which only moved keeps the neutral colour. The rule is extracted into a function so that it can be tested.
Contributor
But isn't it the point of project scheduling -- to be alarmed when your project is going to be delayed? I wouldn't care too much if my task becomes longer of shorter, provided that it meets the end date deadline. |
Contributor
Author
|
This is Taken over bei #2849 |
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.
Symptom
Two things go wrong when a task is compared with its baseline.
its duration changed. A task which used to take 3 days and now takes 5 while
still finishing on the same day shows nothing.
was only moved — same duration, later finish — is painted in the "task
completes later than before" colour, as if it had grown.
Cause
GanttChartSceneBuilder.renderBaselinecompares end dates only:The early
returnis the first symptom. Theif/elseis the second: everydeviating task gets one of the two colours, and which one depends on the end
date alone.
There is a third consequence which is easy to miss.
StyledPainterImplknowsthree colours for a baseline bar — earlier, later, and a neutral one:
The neutral colour is a configurable option, labelled
Task remains on schedule. Because the code above always adds one of the two styles, thatbranch is unreachable today: the option can be set but never shows up on a
baseline bar.
Fix
The decision is moved into a static method which takes the two durations and
the two end dates, so it can be tested without a chart:
latermeans the task now takes longer than in the baseline,earliermeans shorter;
colour — which makes that existing option reachable.
renderBaselinekeeps its structure; only the block above is replaced by a call.Testing
New
BaselineStylesTest: 9 tests, covering an unchanged task, a moved task, alonger task with an unchanged end date, a shorter task ending on the same day,
and a milestone.
Verified the other way round as well: with the old logic put back into the new
method, 5 of the 9 fail, among them
expected: <[later]> but was: <null>(the missing bar) andexpected: <[]> but was: <[earlier]>(the wrongly coloured moved task).A question about the labels
If the colours mean duration rather than end date, two existing option labels
no longer say the right thing:
Both talk about completing, which is end-date language. Something like "Task
takes less time than before" / "Task takes more time than before" would match
the new behaviour, and the third label,
Task remains on schedule, would thenapply to a task which was only moved.
I have deliberately not touched the translations: the wording is yours to
choose, and changing the English string alone would leave every other language
saying the old thing. Happy to add whatever wording you prefer, or to leave it
to you entirely.