[BACKEND] Mark entry as deleted if all entries deleted in update

This commit is contained in:
Jesse Bannon 2023-03-21 14:07:02 -07:00
parent 54b8b76034
commit 4d1568f01a

View file

@ -109,13 +109,21 @@ class InfoJsonDownloader(BaseDownloader[InfoJsonDownloaderOptions]):
# If the original entry file_path is no longer maintained in the new mapping, then
# delete it
num_original_files_deleted: int = 0
for file_name in self._original_entry_mappings[entry.uid].file_names:
if (
entry.uid not in self._entry_mappings
or file_name not in self._entry_mappings[entry.uid].file_names
):
num_original_files_deleted += 1
self._enhanced_download_archive.delete_file_from_output_directory(file_name)
# If all original entry files are deleted, mark it as deleted
if num_original_files_deleted == len(
self._original_entry_mappings[entry.uid].file_names
):
self._enhanced_download_archive.num_entries_removed += 1
def download(self, entry: Entry) -> Entry:
"""
Mock the download by copying the entry file from the output directory into