fixed BUG-76 - no existing for a non-date with move
This commit is contained in:
21
BUGs
21
BUGs
@@ -17,24 +17,3 @@ BUG-75: Tried moving 111 working dir and it failed as dt is invalid/empty? just
|
||||
2 | 43545
|
||||
|
||||
Test move between paths in DEV, should now work
|
||||
BUG-76: Tried moving 111 working dir and it failed as dt is invalid/empty? just means buttons for existing are empty
|
||||
paweb | [2022-01-09 15:42:19,485] ERROR in app: Exception on /getexistingpaths/undefined [POST]
|
||||
paweb | Traceback (most recent call last):
|
||||
paweb | File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2070, in wsgi_app
|
||||
paweb | response = self.full_dispatch_request()
|
||||
paweb | File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1515, in full_dispatch_request
|
||||
paweb | rv = self.handle_user_exception(e)
|
||||
paweb | File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1513, in full_dispatch_request
|
||||
paweb | rv = self.dispatch_request()
|
||||
paweb | File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1499, in dispatch_request
|
||||
paweb | return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
|
||||
paweb | File "/usr/local/lib/python3.8/dist-packages/flask_login/utils.py", line 272, in decorated_view
|
||||
paweb | return func(*args, **kwargs)
|
||||
paweb | File "/code/files.py", line 631, in GetExistingPathsAsDiv
|
||||
paweb | new_dtime=datetime.datetime.strptime(dt, "%Y%m%d") + datetime.timedelta(days=delta)
|
||||
paweb | File "/usr/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
|
||||
paweb | tt, fraction, gmtoff_fraction = _strptime(data_string, format)
|
||||
paweb | File "/usr/lib/python3.8/_strptime.py", line 349, in _strptime
|
||||
paweb | raise ValueError("time data %r does not match format %r" %
|
||||
paweb | ValueError: time data 'undefined' does not match format '%Y%m%d'
|
||||
|
||||
|
||||
7
files.py
7
files.py
@@ -628,7 +628,12 @@ def GetExistingPathsAsDiv(dt):
|
||||
dir_ft=FileType.query.filter(FileType.name=='Directory').first()
|
||||
dirs_arr=[]
|
||||
for delta in range(-7, 8):
|
||||
new_dtime=datetime.datetime.strptime(dt, "%Y%m%d") + datetime.timedelta(days=delta)
|
||||
try:
|
||||
new_dtime=datetime.datetime.strptime(dt, "%Y%m%d") + datetime.timedelta(days=delta)
|
||||
except:
|
||||
# this is not a date, so we cant work out possible dirs, just
|
||||
# return an empty set
|
||||
return "[]"
|
||||
new_dt=new_dtime.strftime('%Y%m%d')
|
||||
dirs_arr+=Dir.query.distinct(Dir.rel_path).filter(Dir.rel_path.ilike('%'+new_dt+'%')).all();
|
||||
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()
|
||||
|
||||
@@ -48,6 +48,8 @@ function GetExistingDirsAsDiv( dt, divname )
|
||||
dirs.forEach( function(item, index) {
|
||||
s+= '<button class="btn btn-outline-primary" type="button" onClick="$(\'#prefix\').val(\''+item.prefix+'\'); $(\'#suffix\').val(\''+item.suffix+'\');return false;">'+item.prefix+'/'+item.suffix+'</button>'
|
||||
} )
|
||||
if( s == '' )
|
||||
$('#existing').html('')
|
||||
$('#'+divname).html(s)
|
||||
}
|
||||
} )
|
||||
@@ -69,7 +71,7 @@ function MoveDBox(path_details, db_url)
|
||||
div+=GetSelnAsDiv()
|
||||
yr=$('.highlight').first().attr('yr')
|
||||
dt=$('.highlight').first().attr('date')
|
||||
div+='<div class="col-12">Use Existing:</div><div id="existing"></div>'
|
||||
div+='<div id="existing" class="col-12">Use Existing:</div><div id="existing"></div>'
|
||||
GetExistingDirsAsDiv( dt, "existing" )
|
||||
div+=`
|
||||
<div class="input-group my-3">
|
||||
|
||||
Reference in New Issue
Block a user