fixed Bug-75, moving dir between paths now works

This commit is contained in:
2022-01-09 18:35:37 +11:00
parent ee8f41bbc2
commit 33ce78cb17
2 changed files with 10 additions and 21 deletions

15
BUGs
View File

@@ -2,18 +2,3 @@
BUG-56: when making a viewing list of AI:mich, (any search?) and going past the page_size, it gets the wrong data from the DB for the 'next' entry
BUG-60: entries per page (in folders view) ignores pagesize, and this also contributes to BUG-56 I think
BUG-74: search/others? remembers start/offset, and if you reset view (e.g. another search) it doesnt show first page of results
BUG-75: Tried moving 111 working dir and it failed as dt is invalid/empty? just means buttons for existing are empty
BUT, although files moved on FS, it is not visible in the DB???
I am in the BIN path!!!!!
pa=# select * from path_dir_link where dir_eid in ( 5, 41818, 41819, 41832, 41921, 43539, 43545 );
path_id | dir_eid
---------+---------
2 | 5
*** 3 | 41818
2 | 41819
2 | 41832
2 | 41921
2 | 43539
2 | 43545
Test move between paths in DEV, should now work

View File

@@ -1037,25 +1037,29 @@ def MoveEntriesToOtherFolder(job, move_me, dst_storage_path, dst_rel_path):
dst_dir=parent_dir.dir_details
# remember, we are moving (move_me - a dir) into this existing dir (dst_dir), so add the name to dst_dir's rel_path...
move_me.dir_details.rel_path = dst_dir.rel_path + '/' + move_me.name
move_me.dir_details.in_path = dst_dir.in_path
move_me.in_dir = dst_dir
move_me.in_path = dst_dir.in_path
session.add(move_me)
# move the actual dir to its new location
AddLogForJob( job, f"INFO: move {orig_fs_pos} -> {move_me.FullPathOnFS()}" )
os.replace( orig_fs_pos, move_me.FullPathOnFS() )
# we use the new path to this new Dir with the full location (the old dir is put into the new location)
ResetAnySubdirPaths( move_me, dst_storage_path, move_me.dir_details.rel_path )
# move the actual dir to its new location
os.replace( orig_fs_pos, move_me.FullPathOnFS() )
AddLogForJob( job, f"INFO: move {orig_fs_pos} -> {move_me.FullPathOnFS()}" )
else:
# scen 4: rename dir -- as the last component of dst_rel_path is what we will rename move_me to, so dont create last bit (os.path.dirname),
# scen 3: rename dir -- as the last component of dst_rel_path is what we will rename move_me to, so dont create last bit (os.path.dirname),
# we will just change move_me into that last dir -> renaming the dir
dst_dir=CreateFSLocation( job, dst_storage_path, os.path.dirname(dst_rel_path) )
move_me.in_dir = dst_dir
move_me.dir_details.rel_path = dst_rel_path
move_me.dir_details.in_path = dst_dir.in_path
move_me.in_dir = dst_dir
move_me.in_path = dst_dir.in_path
move_me.name = os.path.basename(dst_rel_path)
session.add(move_me)
ResetAnySubdirPaths( move_me, dst_storage_path, dst_rel_path )
AddLogForJob( job, f"INFO: move {orig_fs_pos} -> {move_me.FullPathOnFS()}" )
os.replace( orig_fs_pos, move_me.FullPathOnFS() )
AddLogForJob( job, f"INFO: rename {orig_fs_pos} -> {move_me.FullPathOnFS()}" )
return
else:
# make (any needed) Dir for the new destination FS location