fixed bug, where directories with the same name but different path were being lost due to distinct query in DB. I dont really remember why I decided I needed distinct, so this might introduce other issues, but theere is an array merge later that should remove any redundant data, so I think this is better/good for now

This commit is contained in:
2023-01-15 13:31:04 +11:00
parent 13bfedb1a8
commit cc9e827474

View File

@@ -793,9 +793,9 @@ def GetExistingPathsAsDiv(dt):
return make_response( '[]' )
new_dt=new_dtime.strftime('%Y%m%d')
# find dirs named with this date
dirs_arr+=Dir.query.distinct(Dir.rel_path).filter(Dir.rel_path.ilike('%'+new_dt+'%')).all();
dirs_arr+=Dir.query.filter(Dir.rel_path.ilike('%'+new_dt+'%')).all();
# find dirs with non-dirs (files) with this date
dirs_arr+=Dir.query.distinct(Dir.rel_path).join(EntryDirLink).join(Entry).filter(Entry.type_id!=dir_ft.id).filter(Entry.name.ilike('%'+new_dt+'%')).all()
dirs_arr+=Dir.query.join(EntryDirLink).join(Entry).filter(Entry.type_id!=dir_ft.id).filter(Entry.name.ilike('%'+new_dt+'%')).all()
# remove duplicates from array
dirs = set(dirs_arr)