From 19a420f758ab24e0a170283ca23b1110d3ca6770 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 9 Oct 2020 14:20:45 +0100 Subject: [PATCH] Avoid lookups if not needed --- webinterface.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/webinterface.py b/webinterface.py index 0baba49a3..4819d8523 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5419,11 +5419,12 @@ def htmlNewswire(newswire: str, nickname: str, moderator: bool, moderatedItem = False if moderator: moderatedItem = item[5] - totalVotes = votesOnNewswireItem(item[2]) - # show a number of ticks or crosses for how many - # votes for or against - totalVotesStr = \ - votesIndicator(totalVotes, positiveVoting) + if moderatedItem: + totalVotes = votesOnNewswireItem(item[2]) + # show a number of ticks or crosses for how many + # votes for or against + totalVotesStr = \ + votesIndicator(totalVotes, positiveVoting) if moderator and moderatedItem: htmlStr += '

' + \