Improve forecast readability and rep targets
This commit is contained in:
@@ -244,8 +244,9 @@ def get_exercise_progress_for_user(person_id, exercise_id):
|
||||
forecast_enabled = request.args.get('forecast', '').lower() in ('1', 'true', 'yes', 'on')
|
||||
forecast_weeks = request.args.get('forecast_weeks', type=int, default=8)
|
||||
forecast_weeks = max(4, min(forecast_weeks, 26))
|
||||
forecast_target_reps = request.args.get('forecast_reps', type=int, default=5)
|
||||
forecast_target_reps = max(1, min(forecast_target_reps, 12))
|
||||
forecast_target_reps = request.args.get('forecast_reps', type=int)
|
||||
if forecast_target_reps is not None:
|
||||
forecast_target_reps = max(1, min(forecast_target_reps, 20))
|
||||
|
||||
if epoch == 'Custom' and (min_date is None or max_date is None):
|
||||
(min_date, max_date) = db.get_exercise_earliest_and_latest_dates(person_id, exercise_id)
|
||||
|
||||
@@ -405,7 +405,7 @@ class DataBase():
|
||||
def get_all_exercises(self):
|
||||
return self.exercises.get("")
|
||||
|
||||
def get_exercise_progress_for_user(self, person_id, exercise_id, min_date=None, max_date=None, epoch='all', degree=1, forecast_enabled=False, forecast_weeks=8, forecast_target_reps=5):
|
||||
def get_exercise_progress_for_user(self, person_id, exercise_id, min_date=None, max_date=None, epoch='all', degree=1, forecast_enabled=False, forecast_weeks=8, forecast_target_reps=None):
|
||||
today = datetime.now()
|
||||
if epoch == '1M':
|
||||
min_date = today - relativedelta(months=1)
|
||||
|
||||
@@ -32,12 +32,17 @@ M{% for value, position in lower_points %}{{ (((position * vb_width) + margin) |
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro forecast_circles(data_points, labels, color) %}
|
||||
{% macro forecast_circles(data_points, details, color) %}
|
||||
{% for value, position in data_points %}
|
||||
{% set x = (position * vb_width)+margin %}
|
||||
{% set y = (vb_height - value)+margin %}
|
||||
<circle cx="{{ x | int }}" cy="{{ y | int }}" r="1.6" fill="{{ color }}" stroke="{{ color }}"
|
||||
class="pnt-{{ unique_id }}" data-msg="{{ labels[loop.index0][1] }}"></circle>
|
||||
class="pnt-{{ unique_id }}"
|
||||
data-kind="{{ details[loop.index0].kind }}"
|
||||
data-date="{{ details[loop.index0].date }}"
|
||||
data-e1rm="{{ details[loop.index0].e1rm }}"
|
||||
data-topset="{{ details[loop.index0].top_set }}"
|
||||
data-range="{{ details[loop.index0].range }}"></circle>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -53,15 +58,16 @@ M{% for value, position in lower_points %}{{ (((position * vb_width) + margin) |
|
||||
{% set parts = [random_int()] %}
|
||||
{% set unique_id = parts|join('-') %}
|
||||
|
||||
<div class="relative" id="svg-plot-{{ unique_id }}" _="
|
||||
on mouseover from .pnt-{{ unique_id }}
|
||||
put event.target @data-msg into #popover-{{ unique_id }}
|
||||
then remove .hidden from #popover-{{ unique_id }}
|
||||
on mouseout from .pnt-{{ unique_id }}
|
||||
add .hidden to #popover-{{ unique_id }}">
|
||||
<div id="popover-{{ unique_id }}" class="absolute t-0 r-0 hidden bg-white border border-gray-300 p-2 z-10">
|
||||
<!-- Popover content will be dynamically inserted here -->
|
||||
</div>
|
||||
<div class="relative" id="svg-plot-{{ unique_id }}" _="
|
||||
on mouseover from .pnt-{{ unique_id }}
|
||||
put event.target @data-kind into #popover-kind-{{ unique_id }}
|
||||
then put event.target @data-date into #popover-date-{{ unique_id }}
|
||||
then put event.target @data-e1rm into #popover-e1rm-{{ unique_id }}
|
||||
then put event.target @data-topset into #popover-topset-{{ unique_id }}
|
||||
then put event.target @data-range into #popover-range-{{ unique_id }}
|
||||
then remove .hidden from #popover-{{ unique_id }}
|
||||
on mouseout from .pnt-{{ unique_id }}
|
||||
add .hidden to #popover-{{ unique_id }}">
|
||||
<div class="flex items-center justify-between sm:justify-center relative mb-1">
|
||||
<div class="flex flex-col sm:flex-row items-center justify-center w-full gap-x-2">
|
||||
<h4 class="text-lg font-semibold text-blue-400">{{ title }}</h4>
|
||||
@@ -137,24 +143,46 @@ M{% for value, position in lower_points %}{{ (((position * vb_width) + margin) |
|
||||
<div class="mt-3 rounded-lg border border-emerald-100 bg-white/80 px-3 py-2.5">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div>
|
||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500">Estimated top set</div>
|
||||
<div class="text-lg font-bold text-gray-800">{{ forecast.selected_top_set.weight }}kg × {{ forecast.selected_top_set.repetitions }}</div>
|
||||
<div class="text-xs font-semibold uppercase tracking-wide text-gray-500">Projected top set</div>
|
||||
<div class="text-lg font-bold text-gray-800">{{ forecast.selected_top_set.weight_display }}kg × {{ forecast.selected_top_set.repetitions }} reps</div>
|
||||
</div>
|
||||
<div class="text-right text-xs text-gray-500">
|
||||
<div>Likely range</div>
|
||||
<div class="font-semibold text-emerald-700">{{ forecast.selected_top_set.lower_weight }}–{{ forecast.selected_top_set.upper_weight }}kg</div>
|
||||
<div>Model range</div>
|
||||
<div class="font-semibold text-emerald-700">{{ forecast.selected_top_set.lower_weight_display }}–{{ forecast.selected_top_set.upper_weight_display }}kg</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-1.5 mt-2">
|
||||
<span class="text-xs text-gray-400 mr-1">Target reps</span>
|
||||
{% for reps in forecast.target_reps %}
|
||||
<button class="px-2 py-0.5 rounded text-xs {% if forecast.selected_reps == reps %}bg-emerald-700 text-white{% else %}bg-emerald-50 text-emerald-700 hover:bg-emerald-100{% endif %}"
|
||||
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id, epoch=selected_epoch, forecast='true', forecast_weeks=forecast_weeks, forecast_reps=reps) }}"
|
||||
hx-include="#svg-plot-{{ unique_id }} [name='min_date'], #svg-plot-{{ unique_id }} [name='max_date'], #svg-plot-{{ unique_id }} [name='degree']"
|
||||
hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML">{{ reps }}</button>
|
||||
{% endfor %}
|
||||
<div class="text-[11px] text-gray-500 mt-2">
|
||||
Based on {{ forecast.observed_rep_min }}–{{ forecast.observed_rep_max }} reps in view, expanded by ±{{ forecast.rep_buffer }} reps.
|
||||
Click a row to use that rep target in the chart hover.
|
||||
</div>
|
||||
<div class="text-[11px] text-gray-400 mt-2">Rounded to the nearest {{ forecast.target_weight_increment }}kg based on your recorded loads.</div>
|
||||
<div class="text-xs font-semibold text-gray-600 mt-3 mb-1">Rep-to-weight map</div>
|
||||
<div class="mt-2 max-h-64 overflow-y-auto rounded border border-gray-100">
|
||||
<table class="w-full text-xs text-left">
|
||||
<thead class="sticky top-0 bg-gray-50 text-gray-500">
|
||||
<tr>
|
||||
<th class="px-2 py-1.5 font-medium">Reps</th>
|
||||
<th class="px-2 py-1.5 font-medium">Est. load</th>
|
||||
<th class="px-2 py-1.5 font-medium">Model range</th>
|
||||
<th class="px-2 py-1.5 font-medium text-right">Proj. E1RM</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
{% for top_set in forecast.top_sets %}
|
||||
<tr class="cursor-pointer {% if forecast.selected_reps == top_set.repetitions %}bg-emerald-50 text-emerald-800 font-semibold{% else %}bg-white text-gray-600 hover:bg-gray-50{% endif %}"
|
||||
title="Use {{ top_set.repetitions }} reps for chart hover"
|
||||
hx-get="{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise_id, epoch=selected_epoch, forecast='true', forecast_weeks=forecast_weeks, forecast_reps=top_set.repetitions) }}"
|
||||
hx-include="#svg-plot-{{ unique_id }} [name='min_date'], #svg-plot-{{ unique_id }} [name='max_date'], #svg-plot-{{ unique_id }} [name='degree']"
|
||||
hx-target="#svg-plot-{{ unique_id }}" hx-swap="outerHTML">
|
||||
<td class="px-2 py-1.5">{{ top_set.repetitions }}</td>
|
||||
<td class="px-2 py-1.5">{{ top_set.weight_display }}kg</td>
|
||||
<td class="px-2 py-1.5">{{ top_set.lower_weight_display }}–{{ top_set.upper_weight_display }}kg</td>
|
||||
<td class="px-2 py-1.5 text-right">{{ top_set.e1rm_display }}kg</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="text-[11px] text-gray-400 mt-2">Loads rounded to the nearest {{ forecast.target_weight_increment_display }}kg from your recorded increments.</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="flex flex-wrap items-center gap-2 mt-3">
|
||||
@@ -259,7 +287,7 @@ M{% for value, position in lower_points %}{{ (((position * vb_width) + margin) |
|
||||
{% if forecast_enabled and forecast.available %}
|
||||
<path d="{{ path_band(forecast_band_lower, forecast_band_upper, vb_height) }}" fill="#10b981" fill-opacity="0.10" stroke="none"></path>
|
||||
<path d="{{ path(forecast_points, vb_height) }}" stroke="#059669" stroke-width="2" stroke-dasharray="5,3" fill="none"></path>
|
||||
{{ forecast_circles(forecast_points, forecast_labels, '#059669') }}
|
||||
{{ forecast_circles(forecast_points, forecast_details, '#059669') }}
|
||||
<line x1="{{ ((forecast_start_position * vb_width) + margin) | int }}" y1="{{ margin }}" x2="{{ ((forecast_start_position * vb_width) + margin) | int }}" y2="{{ vb_height + margin }}" stroke="#059669" stroke-width="0.8" stroke-dasharray="2,2" stroke-opacity="0.5"></line>
|
||||
{% endif %}
|
||||
{% for plot in plots %}
|
||||
@@ -268,28 +296,58 @@ M{% for value, position in lower_points %}{{ (((position * vb_width) + margin) |
|
||||
</g>
|
||||
{% endfor %}
|
||||
|
||||
<g style="fill-opacity: 0%">
|
||||
{% for pos, message in plot_labels %}
|
||||
{% set x = (pos * vb_width) - (stroke_width/2) + margin %}
|
||||
{% set y = 0 %}
|
||||
{% set width = stroke_width %}
|
||||
{% set height = vb_height + margin %}
|
||||
<rect x="{{ x | int }}" y="{{ y | int }}" width="{{ width | int }}" height="{{ height | int }}"
|
||||
class="pnt-{{ unique_id }}" data-msg="{{ message }}"></rect>
|
||||
<g style="fill-opacity: 0%">
|
||||
{% for detail in plot_details %}
|
||||
{% set x = (detail.position * vb_width) - (stroke_width/2) + margin %}
|
||||
{% set y = 0 %}
|
||||
{% set width = stroke_width %}
|
||||
{% set height = vb_height + margin %}
|
||||
<rect x="{{ x | int }}" y="{{ y | int }}" width="{{ width | int }}" height="{{ height | int }}"
|
||||
class="pnt-{{ unique_id }}"
|
||||
data-kind="{{ detail.kind }}"
|
||||
data-date="{{ detail.date }}"
|
||||
data-e1rm="{{ detail.e1rm }}"
|
||||
data-topset="{{ detail.top_set }}"
|
||||
data-range="{{ detail.range }}"></rect>
|
||||
{% endfor %}
|
||||
{% if forecast_enabled and forecast.available %}
|
||||
{% for pos, message in forecast_labels %}
|
||||
{% set x = (pos * vb_width) - (stroke_width/2) + margin %}
|
||||
{% for detail in forecast_details %}
|
||||
{% set x = (detail.position * vb_width) - (stroke_width/2) + margin %}
|
||||
<rect x="{{ x | int }}" y="0" width="{{ stroke_width | int }}" height="{{ (vb_height + margin) | int }}"
|
||||
class="pnt-{{ unique_id }}" data-msg="{{ message }}"></rect>
|
||||
class="pnt-{{ unique_id }}"
|
||||
data-kind="{{ detail.kind }}"
|
||||
data-date="{{ detail.date }}"
|
||||
data-e1rm="{{ detail.e1rm }}"
|
||||
data-topset="{{ detail.top_set }}"
|
||||
data-range="{{ detail.range }}"></rect>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</g>
|
||||
|
||||
<path d="{{ path_best_fit(best_fit_points, vb_height) }}" stroke="gray" stroke-dasharray="2,1" fill="none"
|
||||
stroke-opacity="60%" />
|
||||
</svg>
|
||||
<div class="flex justify-center pt-2">
|
||||
<path d="{{ path_best_fit(best_fit_points, vb_height) }}" stroke="gray" stroke-dasharray="2,1" fill="none"
|
||||
stroke-opacity="60%" />
|
||||
</svg>
|
||||
<div id="popover-{{ unique_id }}" class="hidden mt-2 rounded-lg border border-gray-200 bg-white px-3 py-2 shadow-sm">
|
||||
<div class="flex items-center justify-between gap-3 mb-1.5">
|
||||
<div id="popover-kind-{{ unique_id }}" class="text-xs font-semibold uppercase tracking-wide text-emerald-700"></div>
|
||||
<div id="popover-date-{{ unique_id }}" class="text-xs text-gray-500"></div>
|
||||
</div>
|
||||
<div class="grid grid-cols-3 gap-2 text-xs">
|
||||
<div class="rounded bg-gray-50 px-2 py-1.5">
|
||||
<div class="text-gray-400">E1RM</div>
|
||||
<div id="popover-e1rm-{{ unique_id }}" class="font-semibold text-gray-800"></div>
|
||||
</div>
|
||||
<div class="rounded bg-gray-50 px-2 py-1.5">
|
||||
<div class="text-gray-400">Top set</div>
|
||||
<div id="popover-topset-{{ unique_id }}" class="font-semibold text-gray-800"></div>
|
||||
</div>
|
||||
<div class="rounded bg-emerald-50 px-2 py-1.5">
|
||||
<div class="text-emerald-600">Range</div>
|
||||
<div id="popover-range-{{ unique_id }}" class="font-semibold text-emerald-800"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-center pt-2">
|
||||
{% for plot in plots %}
|
||||
<div class="flex items-center px-2 select-none cursor-pointer" _="on load put document.querySelector('#svg-plot-{{ unique_id }} g.{{plot.label}}') into my.plot_line
|
||||
on click toggle .hidden on my.plot_line then toggle .line-through on me">
|
||||
|
||||
@@ -9,6 +9,14 @@ from decimal import Decimal
|
||||
|
||||
E1RM_BASE = 101.3
|
||||
E1RM_REP_FACTOR = 2.67123
|
||||
|
||||
|
||||
def _format_kg(value):
|
||||
"""Format a load without noisy trailing zeroes."""
|
||||
numeric_value = float(value)
|
||||
if numeric_value.is_integer():
|
||||
return str(int(numeric_value))
|
||||
return f"{numeric_value:.1f}".rstrip('0').rstrip('.')
|
||||
|
||||
def convert_str_to_date(date_str, format='%Y-%m-%d'):
|
||||
try:
|
||||
@@ -162,6 +170,22 @@ def _round_weight(value, increment, direction='nearest'):
|
||||
return round(rounded, 2)
|
||||
|
||||
|
||||
def infer_rep_targets(repetitions, buffer=5):
|
||||
"""Return an expanded rep range based on the currently visible history."""
|
||||
numeric_reps = sorted({int(round(float(value))) for value in repetitions if value is not None})
|
||||
if not numeric_reps:
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5, None, None
|
||||
|
||||
observed_min = min(numeric_reps)
|
||||
observed_max = max(numeric_reps)
|
||||
target_min = max(1, observed_min - buffer)
|
||||
target_max = min(20, observed_max + buffer)
|
||||
target_reps = list(range(target_min, target_max + 1))
|
||||
centered_reps = int(round(float(np.median(numeric_reps))))
|
||||
centered_reps = max(target_min, min(target_max, centered_reps))
|
||||
return target_reps, centered_reps, observed_min, observed_max
|
||||
|
||||
|
||||
def _top_set_estimates(e1rm, lower_e1rm, upper_e1rm, target_reps, increment):
|
||||
estimates = []
|
||||
for repetitions in target_reps:
|
||||
@@ -171,29 +195,33 @@ def _top_set_estimates(e1rm, lower_e1rm, upper_e1rm, target_reps, increment):
|
||||
expected_weight = e1rm * conversion
|
||||
low_weight = lower_e1rm * conversion
|
||||
high_weight = upper_e1rm * conversion
|
||||
expected = _round_weight(expected_weight, increment)
|
||||
lower = _round_weight(low_weight, increment, 'floor')
|
||||
upper = _round_weight(high_weight, increment, 'ceil')
|
||||
estimates.append({
|
||||
'repetitions': repetitions,
|
||||
'weight': _round_weight(expected_weight, increment),
|
||||
'lower_weight': _round_weight(low_weight, increment, 'floor'),
|
||||
'upper_weight': _round_weight(high_weight, increment, 'ceil')
|
||||
'weight': expected,
|
||||
'weight_display': _format_kg(expected),
|
||||
'lower_weight': lower,
|
||||
'lower_weight_display': _format_kg(lower),
|
||||
'upper_weight': upper,
|
||||
'upper_weight_display': _format_kg(upper),
|
||||
'e1rm_display': _format_kg(e1rm)
|
||||
})
|
||||
return estimates
|
||||
|
||||
|
||||
def add_top_set_forecast(forecast, historical_weights, target_reps=5):
|
||||
def add_top_set_forecast(forecast, historical_weights, historical_repetitions, target_reps=None):
|
||||
"""Attach projected reps x weight combinations to each forecast point."""
|
||||
if not forecast.get('available'):
|
||||
return forecast
|
||||
|
||||
target_reps_list, centered_reps, observed_rep_min, observed_rep_max = infer_rep_targets(historical_repetitions)
|
||||
try:
|
||||
selected_reps = max(1, min(int(target_reps), 12))
|
||||
selected_reps = centered_reps if target_reps is None else int(target_reps)
|
||||
except (TypeError, ValueError):
|
||||
selected_reps = 5
|
||||
target_reps_list = [3, 5, 8, 10]
|
||||
if selected_reps not in target_reps_list:
|
||||
target_reps_list.append(selected_reps)
|
||||
target_reps_list.sort()
|
||||
|
||||
selected_reps = centered_reps
|
||||
selected_reps = max(target_reps_list[0], min(target_reps_list[-1], selected_reps))
|
||||
increment = infer_weight_increment(historical_weights)
|
||||
for point in forecast['points']:
|
||||
point['top_sets'] = _top_set_estimates(
|
||||
@@ -202,6 +230,10 @@ def add_top_set_forecast(forecast, historical_weights, target_reps=5):
|
||||
|
||||
forecast['target_reps'] = target_reps_list
|
||||
forecast['target_weight_increment'] = increment
|
||||
forecast['target_weight_increment_display'] = _format_kg(increment)
|
||||
forecast['observed_rep_min'] = observed_rep_min
|
||||
forecast['observed_rep_max'] = observed_rep_max
|
||||
forecast['rep_buffer'] = 5
|
||||
forecast['top_sets'] = forecast['points'][-1]['top_sets']
|
||||
forecast['selected_reps'] = selected_reps
|
||||
forecast['selected_top_set'] = next(
|
||||
@@ -211,12 +243,12 @@ def add_top_set_forecast(forecast, historical_weights, target_reps=5):
|
||||
return forecast
|
||||
|
||||
|
||||
def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_dates, messages, epoch, person_id, exercise_id, min_date=None, max_date=None, degree=1, forecast_enabled=False, forecast_weeks=8, forecast_target_reps=5):
|
||||
def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_dates, messages, epoch, person_id, exercise_id, min_date=None, max_date=None, degree=1, forecast_enabled=False, forecast_weeks=8, forecast_target_reps=None):
|
||||
# Precompute ranges. Forecast values are included so the projected line and
|
||||
# confidence band have room inside the same SVG coordinate system.
|
||||
observed_min_date, observed_max_date = min(start_dates), max(start_dates)
|
||||
forecast = build_forecast(estimated_1rm, start_dates, forecast_weeks, metric='E1RM') if forecast_enabled else {'available': False}
|
||||
forecast = add_top_set_forecast(forecast, weight, forecast_target_reps)
|
||||
forecast = add_top_set_forecast(forecast, weight, repetitions, forecast_target_reps)
|
||||
chart_max_date = forecast.get('end_date', observed_max_date) if forecast.get('available') else observed_max_date
|
||||
total_span = (chart_max_date - observed_min_date).days or 1
|
||||
|
||||
@@ -294,11 +326,24 @@ def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_da
|
||||
|
||||
# Prepare plot labels
|
||||
plot_labels = list(zip(relative_positions.tolist(), messages))
|
||||
plot_details = []
|
||||
for position, point_date, point_e1rm, point_reps, point_weight in zip(
|
||||
relative_positions.tolist(), start_dates, estimated_1rm, repetitions, weight
|
||||
):
|
||||
plot_details.append({
|
||||
'position': position,
|
||||
'date': point_date.strftime('%d %b %y'),
|
||||
'kind': 'Recorded top set',
|
||||
'e1rm': f"{_format_kg(point_e1rm)}kg",
|
||||
'top_set': f"{_format_kg(point_weight)}kg × {int(point_reps)} reps",
|
||||
'range': 'Recorded value'
|
||||
})
|
||||
|
||||
forecast_points = []
|
||||
forecast_band_lower = []
|
||||
forecast_band_upper = []
|
||||
forecast_labels = []
|
||||
forecast_details = []
|
||||
forecast_start_position = None
|
||||
if forecast.get('available'):
|
||||
forecast_start_position = round((observed_max_date - observed_min_date).days / total_span, 3)
|
||||
@@ -314,9 +359,18 @@ def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_da
|
||||
top_set_message = ''
|
||||
if selected_top_set:
|
||||
top_set_message = (
|
||||
f" · Est. {selected_top_set['weight']}kg × {selected_top_set['repetitions']} "
|
||||
f"(range {selected_top_set['lower_weight']}–{selected_top_set['upper_weight']}kg)"
|
||||
f" · Est. {selected_top_set['weight_display']}kg × {selected_top_set['repetitions']} "
|
||||
f"(range {selected_top_set['lower_weight_display']}–{selected_top_set['upper_weight_display']}kg)"
|
||||
)
|
||||
forecast_details.append({
|
||||
'position': position,
|
||||
'date': point['date'].strftime('%d %b %y'),
|
||||
'kind': 'Projected top set',
|
||||
'e1rm': f"{_format_kg(point['value'])}kg",
|
||||
'top_set': f"{selected_top_set['weight_display']}kg × {selected_top_set['repetitions']} reps",
|
||||
'range': f"{selected_top_set['lower_weight_display']}–{selected_top_set['upper_weight_display']}kg",
|
||||
'confidence': forecast['confidence']
|
||||
})
|
||||
forecast_labels.append((
|
||||
position,
|
||||
f"{point['date'].strftime('%d %b %y')} · Projected E1RM: {point['value']}kg "
|
||||
@@ -331,7 +385,8 @@ def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_da
|
||||
'plots': [repetitions_data, weight_data, estimated_1rm_data],
|
||||
'best_fit_points': best_fit_points,
|
||||
'best_fit_formula': best_fit_formula,
|
||||
'plot_labels': plot_labels,
|
||||
'plot_labels': plot_labels,
|
||||
'plot_details': plot_details,
|
||||
'epochs': ['Custom', '1M', '3M', '6M', 'All'],
|
||||
'selected_epoch': epoch,
|
||||
'person_id': person_id,
|
||||
@@ -342,11 +397,12 @@ def get_exercise_graph_model(title, estimated_1rm, repetitions, weight, start_da
|
||||
'forecast': forecast,
|
||||
'forecast_enabled': forecast_enabled,
|
||||
'forecast_weeks': forecast_weeks,
|
||||
'forecast_target_reps': forecast_target_reps,
|
||||
'forecast_target_reps': forecast.get('selected_reps', forecast_target_reps or 5),
|
||||
'forecast_points': forecast_points,
|
||||
'forecast_band_lower': forecast_band_lower,
|
||||
'forecast_band_upper': forecast_band_upper,
|
||||
'forecast_labels': forecast_labels,
|
||||
'forecast_details': forecast_details,
|
||||
'forecast_start_position': forecast_start_position
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user