Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix JS lint errors

Roland Geider95ee98adfae9
diff --git a/wger/core/templates/index.html b/wger/core/templates/index.html
index f20ca9e3e..459be7a2d 100644
--- a/wger/core/templates/index.html
+++ b/wger/core/templates/index.html
@@ -12,7 +12,7 @@
{% if plan %}
<script>
$(document).ready(function () {
- draw_nutrition_diary_chart({{ plan.pk }});
+ wgerDrawNutritionDiaryChart({{ plan.pk }});
});
</script>
{% endif %}
diff --git a/wger/nutrition/static/js/nutrition.js b/wger/nutrition/static/js/nutrition.js
index 0d1e3f293..16d005f75 100644
--- a/wger/nutrition/static/js/nutrition.js
+++ b/wger/nutrition/static/js/nutrition.js
@@ -97,30 +97,30 @@ function wgerInitIngredientAutocompleter() {
});
}
-
-function draw_nutrition_diary_chart(plan_pk) {
-
- d3.json('/api/v2/nutritionplan/' + plan_pk + '/get_log_overview/', function(data) {
- if(data.length > 0) {
-
- data = MG.convert.date(data, 'date');
- $.getJSON('/api/v2/nutritionplan/' + plan_pk + '/nutritional_values/', function (nutritional_values) {
- MG.data_graphic({
- data: data,
- y_accessor: 'energy',
- x_accessor: 'date',
- full_width: true,
- top: 10,
- left: 30,
- right: 10,
- baselines: [{value: nutritional_values.total.energy,
- label: 'Planned calories (' + nutritional_values.total.energy + 'kcal)'}],
- target: '#nutrition_diary_chart',
- colors: '#4e9a06'
- });
- });
- }
- });
+function wgerDrawNutritionDiaryChart(planPk) {
+ var dataConverted;
+
+ d3.json('/api/v2/nutritionplan/' + planPk + '/get_log_overview/', function (data) {
+ if (data.length > 0) {
+ dataConverted = MG.convert.date(data, 'date');
+ $.getJSON('/api/v2/nutritionplan/' + planPk + '/nutritional_values/',
+ function (nutritionalValues) {
+ MG.data_graphic({
+ data: dataConverted,
+ y_accessor: 'energy',
+ x_accessor: 'date',
+ full_width: true,
+ top: 10,
+ left: 30,
+ right: 10,
+ baselines: [{ value: nutritionalValues.total.energy,
+ label: 'Planned calories (' + nutritionalValues.total.energy + 'kcal)' }],
+ target: '#nutrition_diary_chart',
+ colors: '#4e9a06'
+ });
+ });
+ }
+ });
}
/*
diff --git a/wger/nutrition/templates/plan/view.html b/wger/nutrition/templates/plan/view.html
index 636f69c51..055363345 100644
--- a/wger/nutrition/templates/plan/view.html
+++ b/wger/nutrition/templates/plan/view.html
@@ -25,7 +25,7 @@
{% block header %}
<script>
$(document).ready(function () {
- draw_nutrition_diary_chart({{ plan.pk }});
+ wgerDrawNutritionDiaryChart({{ plan.pk }});
});
function wgerCustomModalInit()