-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "until" keyword in gantt charts #5224
Implement "until" keyword in gantt charts #5224
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5224 +/- ##
============================================
+ Coverage 43.20% 79.23% +36.03%
============================================
Files 23 175 +152
Lines 5115 14535 +9420
Branches 23 868 +845
============================================
+ Hits 2210 11517 +9307
+ Misses 2904 2815 -89
- Partials 1 203 +202
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've consolidated all the requested changes here.
I'm not sure if we should use the current date as a fallback, as the diagram would look different based on when it's opened. Either we should throw an error, or we should use a fixed date based on the other dates in the diagram.
// Test for until
const untilStatement = /^until\s+(?<ids>[\d\w- ]+)/.exec(str);
if (untilStatement) {
// check all until ids and take the earliest
let earliestStartingTask = null;
for (const id of untilStatement.groups.ids.split(' ')) {
let task = findTaskById(id);
if (!task) {
continue;
}
if (earliestStartingTask === null || task.startTime < earliestStartingTask.startTime) {
earliestStartingTask = task;
}
}
if (earliestStartingTask) {
return earliestStartingTask.startTime;
}
// TODO: Not sure if we should use a dynamic date here.
const dt = new Date();
dt.setHours(0, 0, 0, 0);
return dt;
}
…isting impl of keyword 'after'
Just fixed it! |
Can you please separate the tests to new ones? And add a few more cases as well? Tests have helped catch numerous issues recently, and this feature is significant enough to warrant individual tests that specifically state the purpose of the test. Otherwise, in the future, maintainers might not notice subtle failures, or if they do, it'll be difficult to figure out which area is affected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
@fzag, Thank you for the contribution! |
📑 Summary
Implement keyword
until
for tasks that should run until some specific other task or milestone starts.Resolves #3173
📏 Design Decisions
The end date of a task could previously be defined either using a duration (e.g.
1d
) or an absolute date (e.g.2024-01-22
) but not relatively to other tasks/milestones. This is useful in many cases, e.g.: to avoid repeating the end-date of multiple tasks which should end at the same time, rely on critical milestones with specified date, ...📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch