Increment index on fail

merge-requests/30/head
Bob Mottram 2020-04-11 13:51:05 +01:00
parent 6195f4d0e5
commit 9856d34ff4
1 changed files with 7 additions and 6 deletions

View File

@ -757,7 +757,7 @@ def htmlHistorySearch(translate: {}, baseDir: str,
historysearch = historysearch.lower().strip('\n') historysearch = historysearch.lower().strip('\n')
lines = \ boxFilenames = \
searchBoxPosts(baseDir, nickname, domain, searchBoxPosts(baseDir, nickname, domain,
historysearch, postsPerPage) historysearch, postsPerPage)
@ -776,7 +776,7 @@ def htmlHistorySearch(translate: {}, baseDir: str,
historySearchForm += \ historySearchForm += \
'<center><h1>' + translate['Your Posts'] + '</h1></center>' '<center><h1>' + translate['Your Posts'] + '</h1></center>'
if len(lines) == 0: if len(boxFilenames) == 0:
historySearchForm += \ historySearchForm += \
'<center><h5>' + translate['No results'] + \ '<center><h5>' + translate['No results'] + \
'</h5></center>' '</h5></center>'
@ -793,18 +793,19 @@ def htmlHistorySearch(translate: {}, baseDir: str,
# get the start end end within the index file # get the start end end within the index file
startIndex = int((pageNumber - 1) * postsPerPage) startIndex = int((pageNumber - 1) * postsPerPage)
endIndex = startIndex + postsPerPage endIndex = startIndex + postsPerPage
noOfLines = len(lines) noOfBoxFilenames = len(boxFilenames)
if endIndex >= noOfLines and noOfLines > 0: if endIndex >= noOfBoxFilenames and noOfBoxFilenames > 0:
endIndex = noOfLines - 1 endIndex = noOfBoxFilenames - 1
index = startIndex index = startIndex
while index <= endIndex: while index <= endIndex:
postFilename = lines[index] postFilename = boxFilenames[index]
if not postFilename: if not postFilename:
index += 1 index += 1
continue continue
postJsonObject = loadJson(postFilename) postJsonObject = loadJson(postFilename)
if not postJsonObject: if not postJsonObject:
index += 1
continue continue
showIndividualPostIcons = True showIndividualPostIcons = True
allowDeletion = False allowDeletion = False