Skip to content

Commit

Permalink
Fixes a bug where getRule gets run on a joint explanation (#300)
Browse files Browse the repository at this point in the history
## What is the goal of this PR?
Explanation now works as expected when the first explanation is joint. This marks the 1.3.1 release.

## What are the changes implemented in this PR?
While introducing this fix I came to realise that the _unassigned variables_ error message will not be displayed when the target explanation is within the answers of the joint explanation. I have created an issue for it with high priority: #299
  • Loading branch information
Soroush Saffari committed Jun 19, 2020
1 parent a477980 commit 93ad18c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,5 @@
"prebuild": "node version.js",
"unit": "node ./node_modules/jest/bin/jest.js ./test/unit"
},
"version": "1.3.0"
"version": "1.3.1"
}
6 changes: 4 additions & 2 deletions src/renderer/components/Visualiser/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ export default {

const explanation = await node.explanation();

const when = await (await explanation.getRule()).getWhen();
const relRegex = /(\$[^\s]*|;|{)(\s*?\(.*?\))/g;

let isRelUnassigned = false;
const rule = await explanation.getRule();
const when = rule && await rule.getWhen();
const relRegex = /(\$[^\s]*|;|{)(\s*?\(.*?\))/g;
let relMatches = relRegex.exec(when);
while (relMatches) {
if (!relMatches[1].includes('$')) {
Expand Down

0 comments on commit 93ad18c

Please sign in to comment.