summaryrefslogtreecommitdiff
path: root/searx/engines/__init__.py
diff options
context:
space:
mode:
authordalf <alex@al-f.net>2014-10-01 22:25:11 +0200
committerdalf <alex@al-f.net>2014-10-01 22:25:11 +0200
commit829c75897082b74b5301af6d6a27dc0cf9f5e7d6 (patch)
tree6e8bbcde1ec3ce0874306d932d8aef7c48f0cfdf /searx/engines/__init__.py
parent0a71525ab6d4fe4cbc4b33b4653bdb39ae4d55e9 (diff)
parentfce6fb2fa8f1b95d36b8043e0cea160b2f9fc633 (diff)
downloadsearxng-829c75897082b74b5301af6d6a27dc0cf9f5e7d6.tar.gz
searxng-829c75897082b74b5301af6d6a27dc0cf9f5e7d6.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'searx/engines/__init__.py')
-rw-r--r--searx/engines/__init__.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index 82c9407a2..e63dd7189 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -142,16 +142,28 @@ def get_engines_stats():
})
for engine in pageloads:
- engine['percentage'] = int(engine['avg'] / max_pageload * 100)
+ if max_pageload:
+ engine['percentage'] = int(engine['avg'] / max_pageload * 100)
+ else:
+ engine['percentage'] = 0
for engine in results:
- engine['percentage'] = int(engine['avg'] / max_results * 100)
+ if max_results:
+ engine['percentage'] = int(engine['avg'] / max_results * 100)
+ else:
+ engine['percentage'] = 0
for engine in scores:
- engine['percentage'] = int(engine['avg'] / max_score * 100)
+ if max_score:
+ engine['percentage'] = int(engine['avg'] / max_score * 100)
+ else:
+ engine['percentage'] = 0
for engine in scores_per_result:
- engine['percentage'] = int(engine['avg'] / max_score_per_result * 100)
+ if max_score_per_result:
+ engine['percentage'] = int(engine['avg'] / max_score_per_result * 100)
+ else:
+ engine['percentage'] = 0
for engine in errors:
if max_errors: