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
285: Pass interval id to extensions #286
Conversation
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.
The only other thought I have is that I wonder if this should only be enabled when the :ids
hint is specified on the command line? This would be consistent with timew summary
but most consumers of the JSON should probably only be looking for specific keys and would ignore the id tag by default.
src/Interval.cpp
Outdated
if (is_ended ()) | ||
{ | ||
if (is_started ()) | ||
out << ','; | ||
out << "\"end\":\"" << end.toISO () << "\""; | ||
} | ||
out << ",\"end\":\"" << end.toISO () << "\""; |
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.
Here too you'll want to add curly braces.
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 know that there rarely is an interval without a start, but I would prefer to keep lines 109 - 110 for consistency
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.
As I understand lines 109-110 were adding a comma in front only if the start existed because if a start existed, the start would be the first item in the json object but if a start did not exist, the end time would be the first item in the object.
With this change, there is always a defined first item in the object: the id.
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.
@j6s you are definitely right here 😅 - however I found that there is the case of an empty interval which then gets serialized as {"id":0}
instead of {}
.
And also tests dom.t
and interval.t
are broken. They appear green on Travis (should be fixed with dcfe0d1c), but if you inspect the individual runs you see the error reports (e.g. https://travis-ci.org/GothenburgBitFactory/timewarrior/jobs/651153570)
472ed38
to
7db941a
Compare
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.
Empty interval case needs to be addressed
Please check/adapt tests dom.t
and interval.t
Sorry for not finishing this - I had genuinely planned to have a look at it on the weekend. |
@j6s Don't be. You can take a look at the documentation and see whether (or better where) this needs to be updated. And, also important, consider to publish your addon on github/... and tell us about it so we can mention it to other users 😉 |
Passes the
id
of an interval to extensions. Now, stdin of an extension looks like this:Resolves #285