:bug: got a 50x status page when creating a new submission
Closed this issue · 1 comments
Describe the bug
Adding a Submission with the same attributes of a previous one in the same user namespace throw an Internal Server Error
. The same is expected to happen when updating a submission with the same attributes of another one. The reason seems to be the unique key defined in uid.models.Submission
table
To Reproduce
Steps to reproduce the behavior:
- Get a submission with InjectTool
- Create a new submission with the same attributes of the previous one
Expected behavior
It's ok that a user can't create the same object two times in his namespace, however the Internal Server Error
must be avoided and the error message should be provided during the form validation, before attempting to create the new submission
Screenshots
Internal Server Error: /submissions/create/
IntegrityError at /submissions/create/
duplicate key value violates unique constraint "uid_submission_gene_bank_name_gene_bank_b784b3b4_uniq"
DETAIL: Key (gene_bank_name, gene_bank_country_id, datasource_type, datasource_version, owner_id)=(test italy, 8, 0, test 1, 6) already exists.
Additional context
- test for the same key in
submissions.forms.SubmissionFormMixin
- test form invalid and no database changes when using the same attributes
- test error when updating a submission or creating a new one
same applies to the submission update, when the details match to another submission, 500 error.