File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -573,11 +573,12 @@ def delete(cls, artifact_id):
573
573
WHERE artifact_id = %s"""
574
574
qdb .sql_connection .TRN .add (sql , [artifact_id ])
575
575
576
- # If the artifact doesn't have parents, we move the files to the
577
- # uploads folder. We also need to nullify the column in the prep
578
- # template table
579
- if not instance .parents :
580
- qdb .util .move_filepaths_to_upload_folder (study .id , filepaths )
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 )
581
582
582
583
sql = """UPDATE qiita.prep_template
583
584
SET artifact_id = NULL
Original file line number Diff line number Diff line change @@ -721,6 +721,9 @@ def test_create_root_analysis(self):
721
721
self .assertIsNone (obs .study )
722
722
self .assertEqual (obs .analysis , qdb .analysis .Analysis (1 ))
723
723
724
+ # testing that it can be deleted
725
+ qdb .artifact .Artifact .delete (obs .id )
726
+
724
727
def test_create_processed (self ):
725
728
exp_params = qdb .software .Parameters .from_default_params (
726
729
qdb .software .DefaultParameters (1 ), {'input_data' : 1 })
You can’t perform that action at this time.
0 commit comments