Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use bullet points for reps/weight in workout PDF

Roland Geiderb7004c60a5e8
diff --git a/wger/manager/helpers.py b/wger/manager/helpers.py
index 5f4e0ba65..69c9b4c9e 100644
--- a/wger/manager/helpers.py
+++ b/wger/manager/helpers.py
@@ -74,9 +74,17 @@ def render_workout_day(day, nr_of_weeks):
for exercise in set['exercise_list']:
group_exercise_marker[set['obj'].id]['end'] = len(data)
+ # Process the settings
+ if exercise['has_weight']:
+ setting_out = []
+ for i in exercise['setting_text'].split(u'–'):
+ setting_out.append(Paragraph(i, styleSheet["Small"], bulletText=''))
+ else:
+ setting_out = Paragraph(exercise['setting_text'], styleSheet["Small"])
+
data.append([set_count,
Paragraph(exercise['obj'].name, styleSheet["Small"]),
- Paragraph(exercise['setting_text'], styleSheet["Small"])]
+ setting_out]
+ [''] * nr_of_weeks)
set_count += 1
@@ -119,7 +127,7 @@ def render_workout_day(day, nr_of_weeks):
if len(t._argW) > 1:
t._argW[0] = 0.6 * cm # Numbering
t._argW[1] = 4 * cm # Exercise
- t._argW[2] = 2 * cm # Repetitions
+ t._argW[2] = 2.5 * cm # Repetitions
return KeepTogether(t)
diff --git a/wger/manager/pdf.py b/wger/manager/pdf.py
index 527697671..0b42d9772 100644
--- a/wger/manager/pdf.py
+++ b/wger/manager/pdf.py
@@ -184,10 +184,18 @@ def workout_view(request, id, uidb64=None, token=None):
# Note: '+1' here because there's an emtpy cell between days
exercise_markers[day['obj'].id].append(len(data) + 1)
+
+ # Process the settings
+ if exercise['has_weight']:
+ setting_out = []
+ for i in exercise['setting_text'].split(u'–'):
+ setting_out.append(Paragraph(i, styleSheet["Small"], bulletText=''))
+ else:
+ setting_out = Paragraph(exercise['setting_text'], styleSheet["Small"])
+
data.append([set_count,
Paragraph(exercise['obj'].name, styleSheet["Small"]),
- Paragraph(u'<para align="right">{0}</para>'
- .format(exercise['setting_text']), styleSheet["Small"])])
+ setting_out])
set_count += 1
data.append([''])
@@ -258,8 +266,8 @@ def workout_view(request, id, uidb64=None, token=None):
# Manually set the width of the columns
if len(t._argW) > 1:
t._argW[0] = 0.6 * cm # Numbering
- t._argW[1] = 8 * cm # Exercise
- t._argW[2] = 5 * cm # Repetitions
+ t._argW[1] = 10 * cm # Exercise
+ t._argW[2] = 2.5 * cm # Repetitions
# There is nothing to output
else: