diff --git a/src/library/library.cr b/src/library/library.cr index 12d662f..b50fb87 100644 --- a/src/library/library.cr +++ b/src/library/library.cr @@ -153,7 +153,8 @@ class Library title = @title_hash[title_id] existence = title.examine examine_context unless existence - examine_context["deleted_title_ids"].concat [title_id] + title.deep_titles.map &.id + examine_context["deleted_title_ids"].concat [title_id] + + title.deep_titles.map &.id examine_context["deleted_entry_ids"].concat title.deep_entries.map &.id end existence diff --git a/src/library/title.cr b/src/library/title.cr index 6bae693..41efd7c 100644 --- a/src/library/title.cr +++ b/src/library/title.cr @@ -102,7 +102,8 @@ class Title title = Library.default.get_title! title_id existence = title.examine context unless existence - context["deleted_title_ids"].concat [title_id] + title.deep_titles.map &.id + context["deleted_title_ids"].concat [title_id] + + title.deep_titles.map &.id context["deleted_entry_ids"].concat title.deep_entries.map &.id end existence diff --git a/src/storage.cr b/src/storage.cr index 1f0aab7..2f01863 100644 --- a/src/storage.cr +++ b/src/storage.cr @@ -467,13 +467,14 @@ class Storage end # Limit mark targets with given arguments - def mark_unavailable(trash_ids_candidates : Array(String), trash_titles_candidates : Array(String)) + def mark_unavailable(ids_candidates : Array(String), + titles_candidates : Array(String)) MainFiber.run do get_db do |db| # Detect dangling entry IDs trash_ids = [] of String db.query "select path, id from ids where id in " \ - "(#{trash_ids_candidates.join "," { |i| "'#{i}'" }})" do |rs| + "(#{ids_candidates.join "," { |i| "'#{i}'" }})" do |rs| rs.each do path = rs.read String fullpath = Path.new(path).expand(Config.current.library_path).to_s @@ -490,7 +491,7 @@ class Storage # Detect dangling title IDs trash_titles = [] of String db.query "select path, id from titles where id in " \ - "(#{trash_titles_candidates.join "," { |i| "'#{i}'" }})" do |rs| + "(#{titles_candidates.join "," { |i| "'#{i}'" }})" do |rs| rs.each do path = rs.read String fullpath = Path.new(path).expand(Config.current.library_path).to_s