Do we understand the relationship between setting the .effort.effortDone and .effortRemaining properties of tasks through the omniJS API in OP4 macOS ?
There appears to be a bug:
If .effortDone is set (to any value), completed in the GUI shows 0%, and effortRemaining is shown as the same as total effort.
Things seem to go better if we set .effortRemaining to the complementary value, and the API does report a duly updated value, in the expected units (seconds)
In the absence of documentation, and as I personally found this confusing in the first round, here is a summary of what the getting and setting relationships appear to be between the following properties of Task in the macOS OP 4.02 omniJS API:
effortDone is a relatively fixed foot, mainly unaffected by the other two, except when truncated by a new value for effort which is lower than the current value of effortDone.
if a value larger than effort is assigned to effortDone, then effort is expanded to fit, and gets the same value as effortDone.
otherwise, as effortDone expands and shrinks, effortRemaining is adjusted to preserve the equality effort == effortRemaining + effortDone.
effortDone differs from effort and effortRemaining in that setting a negative effortDone value fails without warning (effortDone is simply zeroed), whereas attempts to assign negative values to the other two properties trip JavaScript errors and raise warnings.
effort
effort is always kept larger than or equal to effortDone, truncating the latter if a smaller value is assigned to effort.
otherwise, as effort expands and shrinks, effortDone is assumed to be fixed, and effortRemaining is adjusted to preserve the equality effort == effortRemaining + effortDone.
Assigning a negative value to effort trips a JS error.
effortRemaining
When higher or lower values are assigned to effortRemaining, effortDone is assumed to be fixed, and effort is adjusted accordingly, to preserve the the equality effort == effortRemaining + effortDone.
Assigning a negative value to effortRemaining trips a JS error.
At least, this is my current impression …
In the absence of documentation, caution is a virtue :-)
Your summary of the relationship and expected behaviors with these three effort properties is all spot on. I’ll file a request with the team to better document the interaction between these properties in our scripting API and user manual.