Opened 9 years ago

Closed 9 years ago

#1745 closed defect (fixed)

BioMaterial.getParent() return null after changing the (single) parent of a biomaterial

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 3.2.2
Component: core Version:
Keywords: Cc:

Description

A biomaterial that has a single parent is a special case since that information is also stored in the BioMaterials table (parent_id column). Biomaterials with no or multiple parents have null in this column. The parent information is in all cases also stored in the BioMaterialEventSources2 table.

When using the web gui to switch the parent for a biomaterial that has a single parent, the new parent is added first and the old parent is then removed. The problem is that adding the new parent makes the biomaterial to have two parents and the parent_id column is cleared. When the old parent is removed the column is never populated with the id of the new parent. The result is that the BioMaterial.hasSingleParent() method return false, and the BioMaterial.getParent() return null.

The workaround in the web interface is to first remove the old parent, save and then add the new parent in a second edit operation.

The BASE core code need to be fixed so that removing parent items also triggers an update to the parent_id column when there is only one left.

Change History (4)

comment:1 Changed 9 years ago by Nicklas Nordborg

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 Changed 9 years ago by Nicklas Nordborg

Since this situation have been live for a while, there may be incorrect information stored in the database already. We need to add a fix in the update script that fill in the parent_id column for all biomaterial that has a single parent and is missing this information.

comment:3 Changed 9 years ago by Nicklas Nordborg

(In [6249]) References #1745: BioMaterial?.getParent() return null after changing the (single) parent of a biomaterial

The core code has now been fixed to keep the parent information synchronized in both places. Still need to create an update fix.

comment:4 Changed 9 years ago by Nicklas Nordborg

Resolution: fixed
Status: assignedclosed

(In [6250]) Fixes #1745: BioMaterial?.getParent() return null after changing the (single) parent of a biomaterial

Added fix to update script.

Note: See TracTickets for help on using tickets.