Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove unused code
Roland Geider827f1061be5f
diff --git a/wger/core/templates/index.html b/wger/core/templates/index.htmlindex b45295560..da01b2e73 100644--- a/wger/core/templates/index.html+++ b/wger/core/templates/index.html@@ -7,7 +7,6 @@{# Header #}{# #}{% block header %}-<script src="{% static 'js/weight.js' %}"></script>{% if plan %}<script>diff --git a/wger/weight/static/js/weight.js b/wger/weight/static/js/weight.jsdeleted file mode 100644index d0984f230..000000000--- a/wger/weight/static/js/weight.js+++ /dev/null@@ -1,92 +0,0 @@-/*- This file is part of wger Workout Manager.-- wger Workout Manager is free software: you can redistribute it and/or modify- it under the terms of the GNU Affero General Public License as published by- the Free Software Foundation, either version 3 of the License, or- (at your option) any later version.-- wger Workout Manager is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU Affero General Public License- */-'use strict';--function modifyTimePeriod(data, pastNumberDays) {- var filtered;- var date;- if (data.length) {- if (pastNumberDays !== 'all') {- date = new Date();- date.setDate(date.getDate() - pastNumberDays);- filtered = MG.clone(data).filter(function (value) {- return value.date >= date;- });- return filtered;- }- }- return data;-}--$(document).ready(function () {- var url;- var username;- var chartParams;- var weightChart;- weightChart = {};- chartParams = {- animate_on_load: true,- full_width: true,- top: 10,- left: 30,- right: 10,- show_secondary_x_label: true,- interpolate: d3.curveLinear,- target: '#weight_diagram',- x_accessor: 'date',- y_accessor: 'weight',- xax_count: 5,- min_y_from_data: true,- colors: ['#266dd3']- };-- username = $('#current-username').data('currentUsername');- url = '/weight/api/get_weight_data/' + username;-- d3.json(url).then(function (json) {- var data;- if (json.length) {- data = MG.convert.date(json, 'date');- weightChart.data = data;-- // Plot the data- chartParams.data = data;- MG.data_graphic(chartParams);- }- });-- $('.modify-time-period-controls button').click(function () {- var pastNumberDays = $(this).data('time_period');- var data = modifyTimePeriod(weightChart.data, pastNumberDays);-- // change button state- $(this).addClass('active').siblings().removeClass('active');- if (data.length) {- chartParams.data = data;- MG.data_graphic(chartParams);- }- });-- $(document.querySelector("#enable_bmi")).click(function(){- var height = document.querySelector("#height").value / 100;- //kg = bmi * cm²- let max = height*height * 25;- let min = height*height * 19;- chartParams.baselines = [{value:max, label:"slight overweight"},{value:min, label:"slight underweight"}];- MG.data_graphic(chartParams);- });-});-diff --git a/wger/weight/templates/overview.html b/wger/weight/templates/overview.htmlindex bd5f98eb0..ed016d03c 100644--- a/wger/weight/templates/overview.html+++ b/wger/weight/templates/overview.html@@ -10,7 +10,6 @@{# Header #}{# #}{% block header %}-<script src="{% static 'js/weight.js' %}"></script>{% endblock %}diff --git a/wger/weight/urls.py b/wger/weight/urls.pyindex 76aec783a..b6ab1ef32 100644--- a/wger/weight/urls.py+++ b/wger/weight/urls.py@@ -56,17 +56,4 @@ urlpatterns = [views.overview,name='overview',),- # url(r'^overview/$',- # views.overview,- # name='overview'),- url(- r'^api/get_weight_data/(?P<username>[\w.@+-]+)$', # JS- views.get_weight_data,- name='weight-data',- ),- path(- 'api/get_weight_data/', # JS- views.get_weight_data,- name='weight-data',- ),]diff --git a/wger/weight/views.py b/wger/weight/views.pyindex 2e173f1db..cce655dec 100644--- a/wger/weight/views.py+++ b/wger/weight/views.py@@ -194,31 +194,6 @@ def overview(request, username=None):return render(request, 'overview.html', template_data)-@api_view(['GET'])-def get_weight_data(request, username=None):- """- Process the data to pass it to the JS libraries to generate an SVG image- """-- is_owner, user = check_access(request.user, username)-- date_min = request.GET.get('date_min', False)- date_max = request.GET.get('date_max', True)-- if date_min and date_max:- weights = WeightEntry.objects.filter(user=user, date__range=(date_min, date_max))- else:- weights = WeightEntry.objects.filter(user=user)-- chart_data = []-- for i in weights:- chart_data.append({'date': i.date, 'weight': i.weight})-- # Return the results to the client- return Response(chart_data)--class WeightCsvImportFormPreview(FormPreview):preview_template = 'import_csv_preview.html'form_template = 'import_csv_form.html'