Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1873 closed defect (fixed)

Deleting child biomaterial doesn't return the used quantity to the parent

Reported by: Nicklas Nordborg Owned by: everyone
Priority: critical Milestone: BASE 3.3.3
Component: core Version:
Keywords: Cc:

Description

  1. Create a sample S1 and set original quantity to 500.
  2. Create a child sample S2 and set used quantity from parent to 250.
  3. The S1 sample now has remaining quantity=250.
  4. Delete sample S2 completely (remove from trashcan).
  5. The S1 sample still has remaining quantity=250.

Change History (6)

comment:1 by Nicklas Nordborg, 10 years ago

Once this is fixed we also need to create a procedure for re-calculating the remaining quantity for all existing samples, since we don't know which ones have been affected by this bug.

comment:2 by Nicklas Nordborg, 10 years ago

I have investigated this and found a problem resulting from #1759. Changing to lazy-loading results in Hibernate creating proxy objects that are always a subclass of BioMaterialData and not of the actual real class (eg. SampleData or ExtractData). We also have MeasuredBioMaterialData in this hierarchy and in the code that returns the used quantity we have a check biomaterial instanceof MeasuredBioMaterialData which now returns false since we have a proxy object here. The result is that quantities are never returned.

comment:3 by Nicklas Nordborg, 10 years ago

(In [6577]) References #1873: Deleting child biomaterial doesn't return the used quantity to the parent

This should fix the bug in the place were we spotted it and also in some other potential places were we didn't check if the object was a proxy or not.

comment:4 by Nicklas Nordborg, 10 years ago

(In [6578]) References #1873: Deleting child biomaterial doesn't return the used quantity to the parent

There is no a onetimefix script for fixing this. After updating BASE it should be executed (from the bin directory):

onetimefix.sh remaining_quantity -u <root login> -p <root pwd> 

where login and password is for the root user account in BASE.

Version 0, edited 10 years ago by Nicklas Nordborg (next)

comment:5 by Nicklas Nordborg, 10 years ago

Resolution: fixed
Status: newclosed

(In [6579]) Fixes #1873: Deleting child biomaterial doesn't return the used quantity to the parent

Added instructions to the documentation.

comment:6 by Nicklas Nordborg, 10 years ago

(In [6585]) References #1873: Deleting child biomaterial doesn't return the used quantity to the parent

Test program for change history failed now that the remaining quantity is updated when a child item is deleted. This generates an extra entry in the change history table for the parent item that wasn't accounted for.

Note: See TracTickets for help on using tickets.