@@ -573,25 +573,22 @@ def delete(cls, artifact_id):
573
573
WHERE artifact_id = %s"""
574
574
qdb .sql_connection .TRN .add (sql , [artifact_id ])
575
575
576
- # This block only applies if the artifact has a study AKA not an
577
- # analysis
578
- if study is not None :
579
- # If the artifact doesn't have parents, we move the files to
580
- # the uploads folder. We also need to nullify the column in
581
- # the prep template table
582
- if not instance .parents :
583
- qdb .util .move_filepaths_to_upload_folder (
584
- study .id , filepaths )
585
-
586
- sql = """UPDATE qiita.prep_template
587
- SET artifact_id = NULL
588
- WHERE prep_template_id IN %s"""
589
- qdb .sql_connection .TRN .add (
590
- sql , [tuple (pt .id for pt in instance .prep_templates )])
591
- else :
592
- sql = """DELETE FROM qiita.parent_artifact
593
- WHERE artifact_id = %s"""
594
- qdb .sql_connection .TRN .add (sql , [artifact_id ])
576
+ # If the artifact doesn't have parents and study is not None (is an
577
+ # analysis), we move the files to the uploads folder. We also need
578
+ # to nullify the column in the prep template table
579
+ if not instance .parents and study is not None :
580
+ qdb .util .move_filepaths_to_upload_folder (
581
+ study .id , filepaths )
582
+
583
+ sql = """UPDATE qiita.prep_template
584
+ SET artifact_id = NULL
585
+ WHERE prep_template_id IN %s"""
586
+ qdb .sql_connection .TRN .add (
587
+ sql , [tuple (pt .id for pt in instance .prep_templates )])
588
+ else :
589
+ sql = """DELETE FROM qiita.parent_artifact
590
+ WHERE artifact_id = %s"""
591
+ qdb .sql_connection .TRN .add (sql , [artifact_id ])
595
592
596
593
# Detach the artifact from the study_artifact table
597
594
sql = "DELETE FROM qiita.study_artifact WHERE artifact_id = %s"
0 commit comments