phetsims / arithmetic

"Arithmetic" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/arithmetic
GNU General Public License v3.0
5 stars 5 forks source link

Zero appears in the answer box #195

Closed Nancy-Salpepi closed 1 year ago

Nancy-Salpepi commented 1 year ago

Test device MacBook Air (m1 chip)

Operating System 12.4

Browser Safari

Problem description While testing https://github.com/phetsims/qa/issues/817, on the Division screen I noticed that after the first question, a zero is present in the box where you need to type your answer instead of it being empty. In the published version, the box is empty.

I am not sure if it has to do with the work that was done in https://github.com/phetsims/vegas/issues/102 or other work that was completed. I also didn't see this on the other 2 screens.

Steps to reproduce

  1. Go to the Division screen
  2. Choose any level to play
  3. Correctly answer the first challenge--there will now be a zero in the answer box for the next challenge (and all other challenges after that)

Visuals On Master:

https://user-images.githubusercontent.com/87318828/177433326-9ff00fce-58a1-434a-8351-fad3fc4df411.mp4

** In the published version:

Screen Shot 2022-07-05 at 7 06 33 PM
Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: Arithmetic URL: https://bayes.colorado.edu/dev/phettest/arithmetic/arithmetic_en.html?ea&brand=phet Version: 1.1.0-dev.3 (unbuilt) Features missing: touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15 Language: en-US Window: 1381x665 Pixel Ratio: 2/1 WebGL: WebGL 1.0 GLSL: WebGL GLSL ES 1.0 (1.0) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 30 uniform: 256 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {}
amanda-phet commented 1 year ago

Yikes! This is a very serious bug, thanks for finding it @Nancy-Salpepi . Hopefully we don't re-publish the sim with this issue.

jbphet commented 1 year ago

Good eye @Nancy-Salpepi!

@marlitas - This errant behavior is caused by the switch from parseInt to Number that was done in 29f79fc4ae62029a3fa20d83795bf9922b9de05d. In this sim, the code is counting on the NaN value that was coming from parseInt to blank out the input box, but as you and I found out while working on the problem that came up in expression-exchange, Number('') produces a value of zero.

Please have a look, see if you can resolve it, and let me know if you need any help. I dug through the code for a bit and a good place to start looking is DivideEquationNode, line 33, but there may be other problems, so I'd suggest a thorough regression test.

marlitas commented 1 year ago

@jbphet I took a look and implemented a fix in DivideEquationNode.js Not sure what the best tools for a regression test here are, but I did go through every screen/screen-view to ensure that nothing funky stood out in terms of number/strings in both the answer boxes as well as the grids.

Pleas let me know if there are other tools you recommend I use or look at.

Assigning back to @jbphet for final review of fix.

jbphet commented 1 year ago

@marlitas - thanks for the fix.

@Nancy-Salpepi - Can you please take a look around the sim and see if you see any occurrences of his problem?

Nancy-Salpepi commented 1 year ago

@jbphet @marlitas looks fixed to me!