Rothamsted-Ecoinformatics / farm_rothamsted

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

Experiment Module: Can't add observation #644

Closed aislinnpearson closed 6 months ago

aislinnpearson commented 6 months ago

Hi @mstenta, @paul121,

Myself and Melina were trying to add an observation to this experiment here but got the below error: https://rothamstedfarm.farmos.net/plan/125/plots

Is this something we are doing wrong? It looked to me like it might be a permissions issue?

image

mstenta commented 6 months ago

Hmm strange. I just checked the logs and here is the more detailed message:

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Input value "asset" contains a non-scalar value. in Symfony\Component\HttpKernel\HttpKernel->handle() (line 83 of /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php).

The important bit is: Input value "asset" contains a non-scalar value.

Did you get to the form by selecting assets from a list and clicking "Add log"? I see there are quite a few assets being referenced. I wonder if there's a core bug caused by selecting "too many"...

mstenta commented 6 months ago

Did you get to the form by selecting assets from a list and clicking "Add log"?

Update: I just tried that (from https://rothamstedfarm.farmos.net/plan/125/plots) and replicated the issue.

So yea... this seems like a core bug. :thinking:

mstenta commented 6 months ago

I see there are quite a few assets being referenced. I wonder if there's a core bug caused by selecting "too many"...

Update 2: It doesn't have anything to do with quantity. This URL shows the same issue with a single asset:

https://rothamstedfarm.farmos.net/log/add/observation?destination=/plan/125/plots&asset%5B0%5D=43179

mstenta commented 6 months ago

So yea... this seems like a core bug. 🤔

Update 3: Yup. I replicated this on another instance.

mstenta commented 6 months ago

I opened a core bug report: https://github.com/farmOS/farmOS/issues/813

aislinnpearson commented 6 months ago

Hi @mstenta,

Did you get to the form by selecting assets from a list and clicking "Add log"? I see there are quite a few assets being referenced. I wonder if there's a core bug caused by selecting "too many"...

Yes. It contained 72 plots total

I am almost sure I have seen that 'non-scalar value' in a previous experiment module issue but I had a quick search of all the existing issues (open and closed) but couldn't find it... so maybe I'm making it up.

mstenta commented 6 months ago

@aislinnpearson I figured out the issue and applied a hot-fix to your instance. It should work now!

We'll get this fixed permanently in farmOS core. Thanks for reporting! :+1:

mstenta commented 6 months ago

Core PR: https://github.com/farmOS/farmOS/pull/814

aislinnpearson commented 6 months ago

Okay great. Thank you so much!

mstenta commented 6 months ago

Oops @aislinnpearson we just realized that my "hot fix" fixes the error in this context, but causes it to happen in another one. Now if you go to an asset directly, and click any of the "Add [type] log" buttons in the top right you get "Client error".

So the core bug fix is still a work in progress. I guess the question for you right now @aislinnpearson is: which one is more disruptive? Should I revert my hot-fix so that the the "Add log" buttons work again? Or maybe those don't get used much in practice? We'll get a permanent fix for both soon, but just wanted to flag this.

mstenta commented 6 months ago

Update: fixed both cases. Should be working now.

aislinnpearson commented 6 months ago

Thank you so much @mstenta