clarified bug-82, fixed issue with AI scan optimising still scanning when it should not, finalised back button work for view/viewlist

This commit is contained in:
2022-01-27 21:44:29 +11:00
parent 07b339f5ab
commit 0751cc6010
5 changed files with 72 additions and 81 deletions

View File

@@ -47,14 +47,13 @@ class PA_UserState(db.Model):
class States(PA):
def __init__(self, request):
self.path_type=''
self.orig_search_term = ''
self.url = request.path
self.view_eid = None
self.current=0
self.first_eid=0
self.last_eid=0
print( f"States() - path={request.path}, ref={request.referrer}" )
# this is any next/prev or noo, grouping, etc. change (so use referrer to work out what to do with this)
# because this can happen on a view, or files_up, etc. change this FIRST
if 'ChangeFileOpts' in request.path:
@@ -81,8 +80,6 @@ class States(PA):
pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.path_type==self.path_type,PA_UserState.view_eid==self.view_eid).first()
self.url = pref.orig_url
print( f"NOW, url={self.url}" )
if 'files_ip' in self.url or 'file_list_ip' in self.url:
if self.path_type == "View":
self.orig_ptype = 'Import'
@@ -121,6 +118,8 @@ class States(PA):
if self.path_type == 'View':
pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.path_type==self.path_type,PA_UserState.view_eid==self.view_eid).first()
# should find original path or search for this view (if not a search, search_term='')
orig_pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.path_type==self.orig_ptype,PA_UserState.orig_search_term==self.orig_search_term).first()
elif self.path_type == 'Search':
pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.path_type==self.path_type,PA_UserState.orig_search_term==self.orig_search_term).first()
else:
@@ -140,7 +139,6 @@ class States(PA):
self.orig_url = pref.orig_url
self.view_eid = pref.view_eid
self.current = pref.current
print( f"from existing pref, set self.first_eid to {pref.first_eid}" )
self.first_eid = pref.first_eid
self.last_eid = pref.last_eid
else:
@@ -153,6 +151,8 @@ class States(PA):
if self.path_type == "View":
self.root='static/' + self.orig_ptype
tmp=self.orig_ptype
self.first_eid=orig_pref.first_eid
self.last_eid=orig_pref.last_eid
else:
self.root='static/' + self.path_type
tmp=self.path_type
@@ -177,9 +177,6 @@ class States(PA):
# the above are defaults, if we are here, then we have current values, use them instead if they are set -- AI: searches dont set them so then we use those in the DB first
if request.method=="POST":
print("this was a POST, so use form vals to update PREF" )
for el in request.form:
print( f"{el}={request.form[el]}" )
if 'noo' in request.form:
self.noo=request.form['noo']
if 'how_many' in request.form:
@@ -248,8 +245,6 @@ class States(PA):
db.session.add(pref)
db.session.commit()
print( f"saved pref={pref}" )
return
################################################################################