diff --git a/templates/partials/sparkline.html b/templates/partials/sparkline.html index 5353e89..a89401c 100644 --- a/templates/partials/sparkline.html +++ b/templates/partials/sparkline.html @@ -49,7 +49,7 @@

{{ title }}

{% if best_fit_formula %} - y = {{ best_fit_formula.slope }}x {% if best_fit_formula.intercept != 0 %}+ {{ best_fit_formula.intercept }}{% endif %}, {{ best_fit_formula.kg_per_week }} kg/week, {{ best_fit_formula.kg_per_month }} kg/month + {{ best_fit_formula.kg_per_week }} kg/week, {{ best_fit_formula.kg_per_month }} kg/month {% endif %}

diff --git a/utils.py b/utils.py index bbe2eeb..b11ee63 100644 --- a/utils.py +++ b/utils.py @@ -279,11 +279,9 @@ def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_da best_fit_points = list(zip(y_best_fit, relative_positions)) # Convert the slope from scaled units per day to kg per day - slope_kg_per_day = m * (max_e1rm - min_e1rm) / total_span + slope_kg_per_day = (max_e1rm - min_e1rm) / total_span best_fit_formula = { - 'slope': round(m,1), - 'intercept': round(b,1), 'kg_per_week': round(slope_kg_per_day * 7, 1), # Convert to kg/week 'kg_per_month': round(slope_kg_per_day * 30, 1) # Convert to kg/month }