mirror of
https://github.com/searxng/searxng.git
synced 2024-12-29 20:50:28 +00:00
fix float division by zero bug in score calculation
This commit is contained in:
parent
5dc3eb3399
commit
fdad5f7cad
1 changed files with 16 additions and 4 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue