Skip to content

Commit

Permalink
fix: round success percentage correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskelly committed Oct 30, 2023
1 parent 2b3c51e commit a2365d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/routes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def run_simulation():
engine = SimulationEngine()
engine.gen_all_trials()
df = engine.results.as_dataframes()[0]
success_rate = round(engine.results.success_rate(), ndigits=1)
success_percentage = round(100 * engine.results.success_rate(), ndigits=1)
return render_template(
"simulation.html",
table=df.to_html(classes="table table-striped"),
success_rate=success_rate,
success_percentage=success_percentage,
)
2 changes: 1 addition & 1 deletion app/templates/simulation.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<body>
<div class="container">
<h1>Success Rate: {{success_rate*100}}%</h1>
<h1>Chance of Success: {{success_percentage}}%</h1>
<h1>First Result</h1>
<div class="table-container">
<table class="table table-striped">
Expand Down

0 comments on commit a2365d3

Please sign in to comment.