NHMDenmark / Mass-Digitizer

Common repo for the DaSSCo team
Apache License 2.0
1 stars 0 forks source link

Objectcondition "Needs repair" not cleared in subsequent records #400

Closed FedorSteeman closed 11 months ago

FedorSteeman commented 11 months ago

Issue

Reported by @PipBrewer & @jlegind: "Once you check the Damaged Specimen tick box in the UI and save the record, the tick mark is unchecked for the next record, but it persists in the database with “Needs repair” appearing in subsequent records in the specimen table. If you go back in the UI, you can see that the check box has actually persisted. This goes for NHMD and NHMA."

This kind of 'invisible' value insertion is problematic. Fortunately it was caught before it could pollute Specify imports. It is paramount that we catch these kinds of bugs because they are expensive to correct.

What test are required ?

Continuously monitoring the DB specimen table for inconsistencies while testing the pre-release Digi App.

FedorSteeman commented 11 months ago

The way the data entry form is set up for a new record during saving was deviating from the MVC pattern: It no longer instantiated a new instance of the specimen model, but re-used the current instance, yet failing to clear all fields. It's been brought back to the original method of creating a new instance and transferring sticky field values to that instance.

FedorSteeman commented 11 months ago

Fixed in commit https://github.com/NHMDenmark/Mass-Digitizer/commit/43852d404adbe2295ec131598bca07114f478973

jlegind commented 10 months ago

Specific fix code: newRecord = self.collobj.id == 0 ... ...
# If so, prepare for new blank record ` if newRecord:

Create a new, blank specimen record (id pre-set to 0) `

               ` self.collobj = specimen.Specimen(self.collectionId)  `