forked from zaclys/searxng
Merge pull request #107 from pointhi/float_bug
fix float division by zero bug in score calculation
This commit is contained in:
commit
fce6fb2fa8
@ -142,16 +142,28 @@ def get_engines_stats():
|
|||||||
})
|
})
|
||||||
|
|
||||||
for engine in pageloads:
|
for engine in pageloads:
|
||||||
|
if max_pageload:
|
||||||
engine['percentage'] = int(engine['avg'] / max_pageload * 100)
|
engine['percentage'] = int(engine['avg'] / max_pageload * 100)
|
||||||
|
else:
|
||||||
|
engine['percentage'] = 0
|
||||||
|
|
||||||
for engine in results:
|
for engine in results:
|
||||||
|
if max_results:
|
||||||
engine['percentage'] = int(engine['avg'] / max_results * 100)
|
engine['percentage'] = int(engine['avg'] / max_results * 100)
|
||||||
|
else:
|
||||||
|
engine['percentage'] = 0
|
||||||
|
|
||||||
for engine in scores:
|
for engine in scores:
|
||||||
|
if max_score:
|
||||||
engine['percentage'] = int(engine['avg'] / max_score * 100)
|
engine['percentage'] = int(engine['avg'] / max_score * 100)
|
||||||
|
else:
|
||||||
|
engine['percentage'] = 0
|
||||||
|
|
||||||
for engine in scores_per_result:
|
for engine in scores_per_result:
|
||||||
|
if max_score_per_result:
|
||||||
engine['percentage'] = int(engine['avg'] / max_score_per_result * 100)
|
engine['percentage'] = int(engine['avg'] / max_score_per_result * 100)
|
||||||
|
else:
|
||||||
|
engine['percentage'] = 0
|
||||||
|
|
||||||
for engine in errors:
|
for engine in errors:
|
||||||
if max_errors:
|
if max_errors:
|
||||||
|
Loading…
Reference in New Issue
Block a user