Closed DJWalker42 closed 6 months ago
In the tests, that are passing, we perform a submission of a proposal at the end of the 'testCreateProposal'. Of interest is the fact that in the test we create a new "field" for the observation, rather than refer to one that already exists.
Using the Swagger UI I was able to repeat this error when trying to use the existing (id = 1) "field" in an observation when trying to submit the proposal. Creating a new "field" first then using that in the observation allows the proposal to be submitted.
Closed as invalid. I had a misunderstanding about the 'Field' object. They are defined per proposal (contained by a proposal) rather than existing as a free standing object. In other-words, a proposal cannot reference the 'Field' of another proposal, it must create and reference it's own 'Fields'.
When trying to submit a minimal proposal - single observation of a target with a technical goal - the API responds with a not-null constraint error for the "field id". Currently, the "field" in question exists in the database and the id is hard-coded (value of 1) at the point when an observation is created. Inspecting the database the "field id" member of the observation is set to 1. In the method to "submit" a proposal we take a clone of the proposal and it is the clone that is persisted in the database as a 'SubmittedProposal'. Presumably, the clone hasn't copied the "field" from the id reference for some reason.