NAVADMC / ADSM

A simulation of disease spread in livestock populations. Includes detection and containment simulation.
Other
10 stars 5 forks source link

Airborne Spread - Max distance Null when Linear spread used #923

Closed missyschoenbaum closed 5 years ago

missyschoenbaum commented 5 years ago

I get the following error when Max Distance is null.

1 [main] adsm_simulation 11412 cygwin_exception::open_stackdumpfile: Dumping stack trace to adsm_simulation.exe.stackdump

Max distance is only used on Linear decay, not on exponential. I think we just made this conditional, so I am going to check that issue and then add more notes to this issue.

missyschoenbaum commented 5 years ago

On #794, we made this conditional. I am going to update and test through on it, and then we can decide a next step on this. Possibly we could default a zero so this never fails, or do validation withing conditional since it is fresh in Conrad's head. Maybe there are other options. I am for easy solution. It should not happen if user is filling in all blanks.

missyschoenbaum commented 5 years ago

I remind myself, it is good when I do stupid things and find problems before someone does.

missyschoenbaum commented 5 years ago

OK, tested out #794 and it works great. This only happens when 1) using linear decay and 2) Max distance is null. You guys want to look and see what the easiest solution is? We could enforce the constraint against the database and fill with zero, but making the user enter a real value would be better. The value with persist it they toggle linear off/on.

ConradSelig commented 5 years ago

Why not both? Default value is now 1.1 (minimum valid value for that field), and if the user erases that value and tries to apply the change - it will throw a "This field is required." error.

I got the default value from the MinValueValidator() already attached to the model field. @missyschoenbaum I'm not sure where the number "1.1" came from - if it should be zero that is an easy change to make.

Also, if the user tries to enter anything less than 1.1 it will throw an error to let them know that is the minimum valid value.

missyschoenbaum commented 5 years ago

I think this is OK.

ConradSelig commented 5 years ago

Do you want to leave some sort of comment or link below that field explaining why the minimum value is 1.1?

missyschoenbaum commented 5 years ago

This works perfectly. I went through all options and it is very clear with help text in both places and correct error messages.