[BACKEND] Mark entry as deleted if all entries deleted in update
This commit is contained in:
parent
54b8b76034
commit
4d1568f01a
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue