From fb79e38b65c6d01925315c43f30381dda0213bc7 Mon Sep 17 00:00:00 2001 From: Kevin De Pelseneer Date: Fri, 6 Oct 2023 11:55:51 +0200 Subject: [PATCH] Make sure vanilla assays and studies can be deleted. --- app/controllers/assays_controller.rb | 1 + app/controllers/studies_controller.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/assays_controller.rb b/app/controllers/assays_controller.rb index 796642c82d..dab907ae86 100644 --- a/app/controllers/assays_controller.rb +++ b/app/controllers/assays_controller.rb @@ -114,6 +114,7 @@ def create def delete_linked_sample_types return unless is_single_page_assay? + return if @assay.sample_type.nil? @assay.sample_type.destroy end diff --git a/app/controllers/studies_controller.rb b/app/controllers/studies_controller.rb index bec5ef69fc..c5600c64e2 100644 --- a/app/controllers/studies_controller.rb +++ b/app/controllers/studies_controller.rb @@ -91,6 +91,7 @@ def update def delete_linked_sample_types return unless is_single_page_study? + return if @study.sample_types.empty? # The study sample types must be destroyed in reversed order # otherwise the first sample type won't be removed becaused it is linked from the second