Rothamsted-Ecoinformatics / farm_rothamsted

Custom farmOS features for Rothamsted Research.
GNU General Public License v2.0
6 stars 1 forks source link

FarmOS 3.0: Problems adding files to the experiment design entity #616

Closed aislinnpearson closed 9 months ago

aislinnpearson commented 9 months ago

I had a problem when trying to add files to the design entity, with the following error. I assume that this isn't a problem with the file as I think I uploaded it elsewhere during testing, but have attached it here just in case. Ironically when I tested it again the file uploaded just fine, so maybe worth putting this issue on hold if we can't reproduce it?

image

2020-21_BroomsBarn_FieldLayout.xlsx

paul121 commented 9 months ago

Shoot. This issue is related to AJAX, it is similar to the issue we had in the quick forms. In this example the error message is saying that crd (Completely Randomised Design) is an invalid statistical design choice. Because the statistical design options are refreshed after changing the blocking structure, this error can occur when a file is uploaded after having changed the blocking structure and statistical design. The form "forgets" which block structure was selected, so it defaults to none, and thus there is an invalid statistical design option.

I've pushed a fix here. It's not very complicated, just something to keep in mind when we have file uploads in a form. @mstenta this is a good example of the issue and how to solve it.