syntax-prosody-ot / main

A webapp for the syntax-prosody analyst working in Optimality Theory, with automated Gen, Con and Eval. Download build files from syntax-prosody-ot/build
https://spot.sites.ucsc.edu/
GNU General Public License v2.0
12 stars 2 forks source link

Input validation min input and max input #507

Closed sz245 closed 3 years ago

sz245 commented 3 years ago

Input validation min input and max input

sz245 commented 3 years ago

I can add the comments and check for List of terminals being non-empty. As for the drop down menus, I think that's a good idea. We can discuss it more tomorrow.

sz245 commented 3 years ago

Added the comments and test case for list of terminals.

maxTarlov commented 3 years ago

Unit Tests for save/load have been merged into master, no need to merge from save_load_test To run unit tests on this:

sz245 commented 3 years ago

I changed the code so it would work if there is at least one list of terminals input. There is no input needed for max and min if the list of terminals is empty.

sz245 commented 3 years ago

Thank you. I think it's less code and less complicated now. I hope it's more readable now.

sz245 commented 3 years ago

There is also a save_load branch I did for the drop-down option. I think that could be deleted.

sz245 commented 3 years ago

As I was doing #510, I realized that there was a bug for the function in general. If there is no input for the list of terminal even when the generate combinations and permutations tab is closed, there was still an error staying at least one list of terminal input was needed. It doesn't affect anything but the error display should be removed. I was looking through the interface1.js and I think that some of the code genTerminalStrings() should be copied to the function autoGenInputTree() and not call the genTerminalStrings(). I think you should take a look at the that function genTerminalStrings() and function autoGenInputTree().

jbellik commented 3 years ago

Hmm, good catch. I will take a look. That code was originally written by someone who's not on the team anymore, so I'm not super familiar with it.

jbellik commented 3 years ago

I see what you mean. I got started on this but wasn't able to finish this afternoon, so let's discuss how to proceed tomorrow.

jbellik commented 3 years ago

I fixed the error.

But there's a question we need to address, which is: What are the conditions for us to run generateTerminalStrings() and do all its input validation? In particular, should we still run it as part of what "Generate trees" does even if the fieldset for "Generate combinations and permutations" is closed? That's the current behavior. I had put in a line of code that checks whether the fieldset is open before running the terminal gen, but I commented it out because I was worried that might be an opaque behavior.

A related question: Under what circumstances do we want to display an error because no inputs were provided to terminal gen? I changed the code so that this error will only display if they click the "Generate terminal strings" button without providing any inputs. There is still a warning in the console if they click "Generate trees" and there is nothing in the combinations/permutations input fields, but we could get rid of this or decide it should only appear in some situations, etc.