fix: relink unlinked entry to existing entry without sql error#720
Conversation
CyanVoxel
left a comment
There was a problem hiding this comment.
Your code seems to work just fine here, however upon fixing this there's been yet another issue found with the original implementation that for some reason was changed during the initial jump to SQL.
Thefix_missing_files() method inside missing_files.py file was written incorrectly and tries to remove entries from the files_to_remove list while iterating over it, resulting in not all duplicate entries being removed. The wording in that method is also very confusing to me and mixes terms such as "file" and "entry" and is ambiguous as to what the "fix" actually is. The test for that method also appears to assert the incorrect result, though it's also hard to follow the state of fixtures within pytest.
That is to say, you've done a great job here and rather than ask you to clog this PR with my additional changes, I'll just be pulling this into a new branch and applying these tangential fixes and refactors before pulling into main.
Thank you for working on this!
* fix: relink unlinked entry to existing entry without sql error (#720) * edited and added db functions get_entry_full_by_path & merge_entries * implemented edge case for entry existing on relinking * added test for merge_entries * fix: don't remove item while iterating over list * fix: catch `FileNotFoundError` for unlinked raw files * refactor: rename methods and variables in missing_files.py * refactor: rename `missing_files_count` to `missing_file_entries_count` --------- Co-authored-by: mashed5894 <mashed5894@gmail.com>
Fix for #657. I attempted to use mirror_entry_fields in library.py, but it didn't seem to do what I wanted. I don't know if it's a bug or a skill issue on my part, so I wrote merge_entries to do exactly what I needed.