use an regex match rather than just last part of self.url to find search term as something changed and caused the url to be different on the post - not sure when I broke this, or if an upgrade did, but this fixed BUG-127 and BUG-129 (just a special case of 127)

This commit is contained in:
2024-06-30 17:12:31 +10:00
parent cbea1f09ab
commit 46eb87bc31
2 changed files with 6 additions and 10 deletions

8
BUGs
View File

@@ -19,12 +19,4 @@ BUG-125: when an image is highlighted, then post the contextmenu on a different
There is a chance we need to change the document on click to a mouse down (or whatever the context menu There is a chance we need to change the document on click to a mouse down (or whatever the context menu
uses for default), rather than just fix the highlight uses for default), rather than just fix the highlight
BUG-127: search (via ai search definitely) and then cant sort by oldest/newest, etc.
- also applies to how_many, and then from search I can't go next page without errors
BUG-128: when restarting padb underneath pa, next web requests cause a 500... (need to better catch sql I think, and maybe just retry?) BUG-128: when restarting padb underneath pa, next web requests cause a 500... (need to better catch sql I think, and maybe just retry?)
BUG-129: still can 'try' to go past end, simple reproduction at the moment 'view stats' for AI matches, click on anyone, click next
-- only in PROD (so with DEV and mich > 10 images, showing only 10 it works)
BUG-130: Mich has 2 of her refimgs in DEV that match the NOT_WORKING.jpg (the best should stay, and hopefully that is Mich, then other refimgs for the same person need to be excluded)

View File

@@ -116,7 +116,11 @@ class States(PA):
self.path_type = 'Bin' self.path_type = 'Bin'
elif 'search' in self.url: elif 'search' in self.url:
# okay if we are a search, but came from a view then get last_search_state form prefs and use it # okay if we are a search, but came from a view then get last_search_state form prefs and use it
self.orig_search_term = self.url[8:] m=re.match( '.*search/(.+)$', 'search/AI:dad' )
if m == None:
SetFELog( message=f"ERROR: DDP messed up, seems we are processing a search, but cant see the search term - is this even possible?" )
return
self.orig_search_term = m[1]
if self.path_type == "View": if self.path_type == "View":
self.orig_ptype = 'Search' self.orig_ptype = 'Search'
self.orig_url = self.url self.orig_url = self.url
@@ -263,7 +267,7 @@ class States(PA):
if (self.offset + int(self.how_many)) < self.num_entries: if (self.offset + int(self.how_many)) < self.num_entries:
self.offset += int(self.how_many) self.offset += int(self.how_many)
else: else:
# should be impossible now, but leave jic # tripping this still
SetFELog( message=f"WARNING: next image requested, but would go past end of list? - ignore this" , level="warning", persistent=True, cant_close=False ) SetFELog( message=f"WARNING: next image requested, but would go past end of list? - ignore this" , level="warning", persistent=True, cant_close=False )
if 'current' in request.form: if 'current' in request.form:
self.current = int(request.form['current']) self.current = int(request.form['current'])