From 83a58192848fd84781faa6a982307b274d62e1a0 Mon Sep 17 00:00:00 2001 From: Mats Bovin Date: Fri, 28 Jun 2024 13:18:34 +0200 Subject: [PATCH] Fix issue with deleting a list --- .../au/org/ala/specieslist/SpeciesListController.groovy | 2 +- grails-app/services/au/org/ala/specieslist/HelperService.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grails-app/controllers/au/org/ala/specieslist/SpeciesListController.groovy b/grails-app/controllers/au/org/ala/specieslist/SpeciesListController.groovy index ddca6065..5c2effb6 100644 --- a/grails-app/controllers/au/org/ala/specieslist/SpeciesListController.groovy +++ b/grails-app/controllers/au/org/ala/specieslist/SpeciesListController.groovy @@ -85,8 +85,8 @@ class SpeciesListController { if(sl){ helperService.deleteDataResourceForList(sl.dataResourceUid) List msIds = SpeciesListItem.executeQuery("select sli.matchedSpecies.id as id from SpeciesListItem as sli where dataResourceUid = :dataResourceUid", ["dataResourceUid": sl.dataResourceUid]) - MatchedSpecies.executeUpdate("delete from MatchedSpecies where id in (:msIds)", ["msIds": msIds]) SpeciesListItem.executeUpdate("delete from SpeciesListItem where dataResourceUid = :dataResourceUid", ["dataResourceUid": sl.dataResourceUid]) + MatchedSpecies.executeUpdate("delete from MatchedSpecies where id in (:msIds)", ["msIds": msIds]) SpeciesListKVP.executeUpdate("delete from SpeciesListKVP where dataResourceUid = :dataResourceUid", ["dataResourceUid": sl.dataResourceUid]) SpeciesList.executeUpdate("delete from SpeciesList where dataResourceUid = :dataResourceUid", ["dataResourceUid": sl.dataResourceUid]) } diff --git a/grails-app/services/au/org/ala/specieslist/HelperService.groovy b/grails-app/services/au/org/ala/specieslist/HelperService.groovy index 4365b5ca..eadd5afe 100644 --- a/grails-app/services/au/org/ala/specieslist/HelperService.groovy +++ b/grails-app/services/au/org/ala/specieslist/HelperService.groovy @@ -905,8 +905,8 @@ class HelperService { totalRows = SpeciesListItem.count(); //Total rematch - Clean matchedSpecies table MatchedSpecies.withTransaction { - MatchedSpecies.executeUpdate("delete from MatchedSpecies") SpeciesListItem.executeUpdate("update SpeciesListItem set matched_species_id = null") + MatchedSpecies.executeUpdate("delete from MatchedSpecies") } } }