ubc-carnap-team / Rudolf

Truth Tree Widget for Carnap
2 stars 3 forks source link

Collect formulas. #44

Closed kylemas closed 4 years ago

kylemas commented 4 years ago

Notes:

  1. 2/3 test cases written are passing; the case where the 'tree does not branch' seems to be failing.
  2. Tried doing console logs on the 'resolvedRows' variable (returned by the method I wrote) doesn't seem to be returning anything.
  3. Added a console log statement for inside the for-each loop in my method and it doesn't seem to be reaching that point as well.
for (const idx of nodePath) {
    if (currentNode.nodeType !== 'formulas') {
      throw new Error('Failed to get node path')
    }

    currentNode.formulas.forEach((element) => {
      if (element.resolved) {
        resolvedRows.push(element.row)
        console.log("Element pushed")
      }
      console.log(resolvedRows)
    })
    currentNode = currentNode.forest[idx]
  }
McTano commented 4 years ago

Did you read my message on slack? I explained why it's not working. The outer loop doesn't run when there's only a root node.

On Tue, May 12, 2020, 9:47 PM Kyle Mas notifications@github.com wrote:

Notes:

  1. 2/3 test cases written are passing; the case where the 'tree does not branch' seems to be failing.
  2. Tried doing console logs on the 'resolvedRows' variable (returned by the method I wrote) doesn't seem to be returning anything.
  3. Added a console log statement for inside the for-each loop in my method and it doesn't seem to be reaching that point as well.

for (const idx of nodePath) { if (currentNode.nodeType !== 'formulas') { throw new Error('Failed to get node path') }

currentNode.formulas.forEach((element) => {
  if (element.resolved) {
    resolvedRows.push(element.row)
    console.log("Element pushed")
  }
  console.log(resolvedRows)
})
currentNode = currentNode.forest[idx]

}

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/McTano/Rudolf/pull/44#issuecomment-627743111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFHH6RHO5VDAZZS6XHJQHTRRIQ47ANCNFSM4M2XOEHQ .

kylemas commented 4 years ago

Sorry, I didn't catch your last message on Slack! I made some changes and the test cases are passing now.

McTano commented 4 years ago

Good work! Just to be safe, add a test case for the other case, where the tree does have more than one node, but doesn't branch. And make sure to remove all those console.logs.

kylemas commented 4 years ago

@McTano Done!

kylemas commented 4 years ago

@McTano Changed the input parameters in the RudolfReducer file! Should be working out now.