Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix bug that caused D3 to not render the results

Roland Geiderbb3b21d4528b
diff --git a/wger/exercises/static/js/exercises.js b/wger/exercises/static/js/exercises.js
index b07ea31d8..db5cc49de 100644
--- a/wger/exercises/static/js/exercises.js
+++ b/wger/exercises/static/js/exercises.js
@@ -119,7 +119,7 @@ function weight_log_chart(data, div_id, reps_i18n, width_factor) {
var reps = color.domain().map(function (name) {
var temp_values = data.filter(function(d) {
- return(+d[name] > 0);
+ return (d[name] != 'n.a');
});
var filtered_values = temp_values.map(function (d) {
diff --git a/wger/weight/helpers.py b/wger/weight/helpers.py
index f48a2c7cb..0eb453288 100644
--- a/wger/weight/helpers.py
+++ b/wger/weight/helpers.py
@@ -113,7 +113,10 @@ def process_log_entries(logs):
if entry.reps == rep:
temp[rep] = entry.weight
else:
- temp[rep] = 0
+ # Mark entries without data, this is later filtered out by D3.
+ # We use the string 'n.a' instead of 0 to differentiate actual exercises
+ # where no weight was used.
+ temp[rep] = 'n.a'
chart_data.append(temp)
return entry_log, json.dumps(chart_data, cls=DecimalJsonEncoder)