Changeset 7385


Ignore:
Timestamp:
Jun 2, 2017, 9:34:09 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2088: Moving a biomaterial causes the free wells counter on the old plate to become incorrect

This seems to fix the problem with the counters. Need to implement a script that fixes all counters that are incorrect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.11-stable/src/core/net/sf/basedb/core/MeasuredBioMaterial.java

    r7308 r7385  
    537537    {
    538538      currentWell.setBioMaterial(null);
    539       currentWell.getBioPlate().updateFreeWells(1);
     539      updateFreeWells(currentWell.getBioPlate(), 1);
    540540    }
    541541    if (newWell != null)
    542542    {
    543543      newWell.setBioMaterial(myData);
    544       newWell.getBioPlate().updateFreeWells(-1);
     544      updateFreeWells(newWell.getBioPlate(), -1);
    545545    }
    546546    myData.setBioWell(newWell);
     
    556556  {
    557557    return getDbControl().getItem(BioWell.class, getData().getBioWell());
     558  }
     559 
     560  private void updateFreeWells(BioPlateData plate, int delta)
     561  {
     562    // Ensure that the changes are made to an instance in this session
     563    if (plate.getId() != 0)
     564    {
     565      plate = HibernateUtil.loadData(getDbControl().getHibernateSession(), BioPlateData.class, plate.getId());
     566    }
     567    plate.updateFreeWells(delta);
    558568  }
    559569 
Note: See TracChangeset for help on using the changeset viewer.