AAFC-BICoE / dina-planning

AAFC-DINA planning repository
3 stars 2 forks source link

Determination error when trying to save #317

Closed banchinic closed 2 years ago

banchinic commented 2 years ago

I am trying to save a Material Sample. The only thing I changed is I added pictures as attachments. Now I can't save anymore and I get the error: Validation error: There must be at least one and only one primary determination.

There is only one determination. At first, there was only one verbatim determination. I tried to add a determination with the COL and I still get the same error.

We need to be able to save samples with no determination and some will also have a different verbatim determination than the CoL determination. I assume this is a bug?

It's Material Sample INVIVO2338C

dshorthouse commented 2 years ago

Sounds like a bug, perhaps in relation to https://github.com/AAFC-BICoE/natural-history-collection-api/issues/273 if there's been work on that & if there's not been any migration of existing data in demo. What happens if you remove the determination altogether, save the form, then add the determination anew?

dshorthouse commented 2 years ago

Hmm. I was able to replicate this, but perhaps through a slightly different means.

  1. Add a single determination & save (that presently gets marked as primary by default)
  2. Add a second determination & save
  3. Remove the first primary determination & attempt to save

...unless you explicit set the now single determination as primary once the original primary determination is removed, you cannot save without an error.

cgendreau commented 2 years ago

Should be fixed now

banchinic commented 2 years ago

I tried again but anytime I try to add an image to a Material sample I get the same error: Validation error: There must be at least one and only one primary determination. Even though I haven't modified anything in the determination field I was just adding images. I also got a Internal Server error once on another record.

cgendreau commented 2 years ago

The incorrect validation message is fixed. As for the Internal Server error I would need more details.

banchinic commented 2 years ago

Ok so I was able to add attachments (pictures) when creating a new material sample. However when I try to attach the pictures to an existing material sample (INVIVO2338B) I still get the same error: Validation error: There must be at least one and only one primary determination.

If it's fixed for all future material samples (and then editing them) then no worries but just so you know.

cgendreau commented 2 years ago

Multiple Determinations without a Primary is now available for MixedOrganism.