f5598a18d5c79e49b0af807ac9845250e1f9824a,app/grandchallenge/archives/models.py,Archive,delete,#Archive#,22

Before Change


            images_to_remove
        )

        Patient.objects.filter(
            study__image__in=images_to_remove
        ).distinct().exclude(pk__in=protected_patient_ids).delete(
            *args, **kwargs
        )
        Study.objects.filter(image__in=images_to_remove).distinct().exclude(
            pk__in=protected_study_ids
        ).delete(*args, **kwargs)
        images_to_remove.delete(*args, **kwargs)

After Change


            images_to_remove
        )

        with transaction.atomic():
            Patient.objects.filter(
                study__image__in=images_to_remove
            ).distinct().exclude(pk__in=protected_patient_ids).delete(
                *args, **kwargs
            )
            Study.objects.filter(
                image__in=images_to_remove
            ).distinct().exclude(pk__in=protected_study_ids).delete(
                *args, **kwargs
            )
            images_to_remove.delete(*args, **kwargs)

            super().delete(*args, **kwargs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 3

Instances


Project Name: comic/grand-challenge.org
Commit Name: f5598a18d5c79e49b0af807ac9845250e1f9824a
Time: 2019-09-10
Author: harm.van.zeeland@gmail.com
File Name: app/grandchallenge/archives/models.py
Class Name: Archive
Method Name: delete


Project Name: comic/grand-challenge.org
Commit Name: c610126cc645933cc24fd4f6548ed953caa6d857
Time: 2018-06-27
Author: pkcakeout@gmail.com
File Name: app/tests/cases_tests/test_background_tasks.py
Class Name:
Method Name: test_staged_uploaded_file_cleanup_interferes_with_image_build