Embed achievement badges in exercise progress graphs
This commit is contained in:
8
db.py
8
db.py
@@ -427,6 +427,11 @@ class DataBase():
|
|||||||
start_dates = [t['start_date'] for t in topsets]
|
start_dates = [t['start_date'] for t in topsets]
|
||||||
messages = [f'{t["repetitions"]} x {t["weight"]}kg ({t["estimated_1rm"]}kg E1RM) on {t["start_date"].strftime("%d %b %y")}' for t in topsets]
|
messages = [f'{t["repetitions"]} x {t["weight"]}kg ({t["estimated_1rm"]}kg E1RM) on {t["start_date"].strftime("%d %b %y")}' for t in topsets]
|
||||||
|
|
||||||
|
# Get the latest topset info for badges
|
||||||
|
latest_topset = topsets[-1]
|
||||||
|
latest_topset_id = latest_topset['topset_id']
|
||||||
|
latest_workout_id = latest_topset['workout_id']
|
||||||
|
|
||||||
exercise_progress = get_exercise_graph_model(
|
exercise_progress = get_exercise_graph_model(
|
||||||
exercise_name,
|
exercise_name,
|
||||||
estimated_1rm,
|
estimated_1rm,
|
||||||
@@ -440,6 +445,9 @@ class DataBase():
|
|||||||
min_date,
|
min_date,
|
||||||
max_date,
|
max_date,
|
||||||
degree)
|
degree)
|
||||||
|
|
||||||
|
exercise_progress['latest_topset_id'] = latest_topset_id
|
||||||
|
exercise_progress['latest_workout_id'] = latest_workout_id
|
||||||
|
|
||||||
return exercise_progress
|
return exercise_progress
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,12 @@
|
|||||||
<div id="popover-{{ unique_id }}" class="absolute t-0 r-0 hidden bg-white border border-gray-300 p-2 z-10">
|
<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 -->
|
<!-- Popover content will be dynamically inserted here -->
|
||||||
</div>
|
</div>
|
||||||
<h4 class="text-l font-semibold text-blue-400 text-center">{{ title }}</h4>
|
<div class="flex items-center justify-center gap-2 mb-1">
|
||||||
|
<h4 class="text-l font-semibold text-blue-400">{{ title }}</h4>
|
||||||
|
<div hx-get="{{ url_for('workout.get_topset_achievements', person_id=person_id, workout_id=latest_workout_id, topset_id=latest_topset_id) }}"
|
||||||
|
hx-trigger="load" hx-target="this" hx-swap="innerHTML" class="flex items-center">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h2 class="text-xs font-semibold text-blue-200 mb-1 text-center">
|
<h2 class="text-xs font-semibold text-blue-200 mb-1 text-center">
|
||||||
{% if best_fit_formula %}
|
{% if best_fit_formula %}
|
||||||
{{ 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
|
||||||
|
|||||||
Reference in New Issue
Block a user