Voting logic

merge-requests/30/head
Bob Mottram 2020-10-09 13:48:13 +01:00
parent 9a7a6db47b
commit 53ed0774e6
1 changed files with 25 additions and 22 deletions

View File

@ -2935,28 +2935,31 @@ def createBoxIndexed(recentPostsCache: {},
print('Arrival: mins ' + \ print('Arrival: mins ' + \
str(timeDiffMins) + ' ' + str(votingTimeMins)) str(timeDiffMins) + ' ' + str(votingTimeMins))
# has the voting time elapsed? # has the voting time elapsed?
if timeDiffMins > votingTimeMins: if timeDiffMins < votingTimeMins:
# if there a votes file for this post? # voting is still happening, so don't add this
votesFilename = \ # post to the timeline
locateNewsVotes(baseDir, domain, postFilename) continue
if votesFilename: # if there a votes file for this post?
# load the votes file and count the votes votesFilename = \
votesJson = loadJson(votesFilename, 0, 2) locateNewsVotes(baseDir, domain, postFilename)
if votesJson: if votesFilename:
if not positiveVoting: # load the votes file and count the votes
if votesOnNewswireItem(votesJson) >= \ votesJson = loadJson(votesFilename, 0, 2)
newswireVotesThreshold: if votesJson:
# Too many veto votes. if not positiveVoting:
# Continue without incrementing if votesOnNewswireItem(votesJson) >= \
# the posts counter newswireVotesThreshold:
continue # Too many veto votes.
else: # Continue without incrementing
if votesOnNewswireItem < \ # the posts counter
newswireVotesThreshold: continue
# Not enough votes. else:
# Continue without incrementing if votesOnNewswireItem < \
# the posts counter newswireVotesThreshold:
continue # Not enough votes.
# Continue without incrementing
# the posts counter
continue
# Skip through any posts previous to the current page # Skip through any posts previous to the current page
if postsCtr < int((pageNumber - 1) * itemsPerPage): if postsCtr < int((pageNumber - 1) * itemsPerPage):