File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -218,9 +218,18 @@ func HandleScanDeleteReq(req *protos.ScanDeleteReq, hctx wsHelpers.HandlerContex
218218 return nil , errorwithstatus .MakeBadRequestError (fmt .Errorf ("Specified title did not match scan title of: \" %v\" " , dbItem .Title ))
219219 }
220220
221- // Check that it's not an FM dataset
222- if dbItem .Instrument == protos .ScanInstrument_PIXL_FM {
223- return nil , errorwithstatus .MakeBadRequestError (errors .New ("Cannot delete FM datasets using this feature" ))
221+ // Only allow deleting an FM dataset if it doesn't have any spectra or images - as it might be a safety survey or other failed scan
222+ // that we don't want to keep around
223+ imageCount := 0
224+ for _ , dt := range dbItem .DataTypes {
225+ if dt .DataType == protos .ScanDataType_SD_IMAGE && dt .Count > 0 {
226+ imageCount = int (dt .Count )
227+ break
228+ }
229+ }
230+
231+ if dbItem .Instrument == protos .ScanInstrument_PIXL_FM && (dbItem .ContentCounts ["BulkSpectra" ] > 0 || dbItem .ContentCounts ["NormalSpectra" ] > 0 || imageCount > 0 ) {
232+ return nil , errorwithstatus .MakeBadRequestError (errors .New ("Cannot delete FM datasets containing spectra or images using this feature" ))
224233 }
225234
226235 // TODO: Should we stop deletion if images or quants reference it???
You can’t perform that action at this time.
0 commit comments