Self hosted FLOSS fitness/workout, nutrition and weight tracker
more logic and representation
Tonye56e8625c4a5
diff --git a/wger/manager/helpers.py b/wger/manager/helpers.pyindex 172f87440..54e879449 100644--- a/wger/manager/helpers.py+++ b/wger/manager/helpers.py@@ -204,6 +204,17 @@ def reps_smart_text(settings, set_obj)::return setting_text, setting_list:"""+ def get_rpe_representation(setting):+ """+ Returns the representation for the rpe for a setting+ """++ if setting.rpe:+ rpe = "{0} RPE".format(setting.rpe)+ else:+ rpe = ""+ return rpe+def get_reps_reprentation(setting, rep_unit):"""Returns the representation for the repetitions for a setting@@ -212,7 +223,7 @@ def reps_smart_text(settings, set_obj):"Until Failure" unit"""if setting.repetition_unit_id != 2:- reps = "{0} {1} ({2})".format(setting.reps, rep_unit, setting.rpe).strip()+ reps = "{0} {1}".format(setting.reps, rep_unit).strip()else:reps = '∞'return reps@@ -258,12 +269,20 @@ def reps_smart_text(settings, set_obj):reps = get_reps_reprentation(settings[0], rep_unit)weight_unit = settings[0].weight_unitweight = normalize_weight(settings[0])+ rpe = get_rpe_representation(settings[0])setting_text = '{0} × {1}'.format(set_obj.sets, reps).strip()setting_list_text = '{0} {1}'.format(reps, rep_unit).strip()if weight:- setting_text += ' ({0} {1})'.format(weight, weight_unit)- setting_list_text += ' ({0} {1})'.format(weight, weight_unit)+ setting_text += ' ({0} {1}'.format(weight, weight_unit)+ setting_list_text += ' ({0} {1}'.format(weight, weight_unit)++ setting_text += ', {0})'.format(rpe) if rpe else ')'+ setting_list_text += ', {0})'.format(rpe) if rpe else ')'++ else:+ setting_text += ' ({0})'.format(rpe) if rpe else ''+ setting_list_text += ' ({0})'.format(rpe) if rpe else ''setting_list = [setting_list_text] * set_obj.setsreps_list = [settings[0].reps] * set_obj.sets@@ -284,8 +303,12 @@ def reps_smart_text(settings, set_obj):rep_unit = get_weight_unit_reprentation(setting)reps = get_reps_reprentation(setting, rep_unit)weight = normalize_weight(setting)+ rpe = get_rpe_representation(setting)if weight:- reps += ' x {0} {1}'.format(weight, setting.weight_unit)+ reps += ' ({0} {1}'.format(weight, setting.weight_unit)+ reps += ', {0})'.format(rpe) if rpe else ')'+ else:+ reps += ' ({0})'.format(rpe) if rpe else ''tmp_reps_text.append(reps)tmp_reps.append(setting.reps)