amschaal / glims

3 stars 0 forks source link

Error page if duplicate lab created #41

Closed monicabritton closed 6 years ago

monicabritton commented 6 years ago

If you try to create a new lab for one that already exists, instead of a pleasant pop-up message like: "Doe, John lab already exists in BioBin" An ugly systems error pops up starting with: IntegrityError at /labs/create duplicate key value violates unique constraint "glims_lab_slug_key"

But, what happens when, someday, we really do have two PIs with the same name?

Ideally, the error message should read: "Doe, John lab already exists in BioBin. Do you really want to create another Doe, John lab?"

And have some provision for PIs with the same name.

amschaal commented 6 years ago

Yes, a nicer error message would be better. The "slug" field for the group is the unique identifier that will be used by the system for organizing data on the filesystem. Hence, it must be unique. It is being generated by the combination of lab first and last names. Consequentially, it expects those combined to be unique.

We COULD instead allow the user to choose the "slug" or lab identifier, but default to last_first. Either way, the name of the lab is the best way to identify a lab. So if you have 2 John Doe labs, 1 should be the "John A. Doe" lab, and the other the "John B. Doe" lab, or something else that makes it obvious when you are viewing a list of the labs.