thinkthroughmath / ttm-coffeescript-math

Coffeescript math library used in Think Through Math
MIT License
1 stars 0 forks source link

MATH-1825: Handle minus button exception #9

Closed gbl-jackibarra closed 5 years ago

gbl-jackibarra commented 5 years ago

Closes MATH-1825

Purpose Pressing the (^) after a subtract sign (-), causes the next click to crash. On lesson player, this brings up the Something went wrong screen. Locally, you cannot press any other buttons. This fix allows you to do this without raising any exception .

To QA

First scenario:

  1. Open the calculator in lesson-player
  2. Press - (Subtract) button once
  3. Press the ^ button once
  4. Press any other button

Second scenario:

  1. Open the calculator in lesson-player
  2. Press a digit (0-9)
  3. Hit the '^' button
  4. Hit any one of the operator buttons '+,-,*,/'
  5. Hit the '^' button It crashes at this point.
kamnayadavIL commented 5 years ago

Verified the changes on local environment and the following are the findings:

  1. If '-' is the first operator (nothing else was clicked before that), and then '^' is clicked then the error does not happen. This is fixed.
  2. However, if we click on a digit (0-9) and then click on '^', '+,-,*,%' (any of the 4 operators) and then '^', it crashes right away.

In my opinion, it might be wise to avoid the clicking of any operators right after the '(' since it's technically looking for an operand.

Calculator_crash.zip

kamnayadavIL commented 5 years ago

After further investigation, it always fails when there is a left parenthesis, and operator and then the carat sign. One other thing I observed was that if we enter an equation, into the calculator, that has a trailing operator (tried with +,-,*,/) then it shows an 'Error' in the calculator screen/label.

step_1 step_2

We might want better handling of where the operators should be considered in the calculation and where they should get ignored.

kamnayadavIL commented 5 years ago

Removed the code review and QA labels as per discussion with Jack who will be working on a solution for the error.

gbl-jackibarra commented 5 years ago

@james-west-il I updated the PR. so kamna requested for re-approve it

kamnayadavIL commented 5 years ago

The failure can still be seen. Assigning to Jack as per our discussion.

kamnayadavIL commented 5 years ago

Verified on local machine. Working fine. Passed QA.