Calculate - Scientific Operation Doesn't Work
Closed this issue · 4 comments
Upon testing the Scientific Operation in the Calculate action I've discovered that the correct shortcut format isn't being generated.
A standard Calculate action has 2 properties, WFMathOperand
and WFMathOperation
.
When using a Scientific Operation a 3rd property is used WFScientificMathOperation
.
When using a Scientific Operation with Shortcuts-JS the WFMathOperation
property is being removed when it should be being set to ...
This is a sample output from the Shortcuts app:
<array>
<dict>
<key>WFWorkflowActionIdentifier</key>
<string>is.workflow.actions.math</string>
<key>WFWorkflowActionParameters</key>
<dict>
<key>WFMathOperand</key>
<integer>0</integer>
<key>WFMathOperation</key>
<string>…</string>
<key>WFScientificMathOperation</key>
<string>tan(x)</string>
</dict>
</dict>
</array>
Using this JS:
const actions = [
calculate({
operand: 0,
operation: "tan(x)"
})
];
in Shortcuts-JS produces a shortcut without the WFMathOperation
property:
<array>
<dict>
<key>WFWorkflowActionIdentifier</key>
<string>is.workflow.actions.math</string>
<key>WFWorkflowActionParameters</key>
<dict>
<key>WFMathOperand</key>
<integer>0</integer>
<key>WFMathOperation</key>
<string>tan(x)</string>
</dict>
</dict>
</array>
@gcordalis, great find! 😃
I did some researches and I found that there's also a WFScientificMathOperand
property.
I pulled a fix in #42.
Good spot, thanks @gcordalis!
Fixed in #42.
Just a note for anyone using this in the action.
...
doesn't work, you need to use …
\u2026
instead of \u002e\u002e\u002e
@joshfarrant @xAlien95 Looking over this again, the PR that fixed this uses ...
. I've submitted a PR #48 that addresses this.