Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Don't process the weight chart if there are no weight entries

Roland Geiderdb737c973610
diff --git a/weight/templates/weight_overview.html b/weight/templates/weight_overview.html
index 5fa668039..01f18c348 100644
--- a/weight/templates/weight_overview.html
+++ b/weight/templates/weight_overview.html
@@ -37,37 +37,38 @@ $(document).ready(function () {
{
filter_data = {'date_min': date_min,
'date_max': date_max}
- }
-
- $.getJSON("/weight/api/get_weight_data/", filter_data, function(json) {
- weight_chart(json);
- });
-
- // Add datepickers to the filter elements
- $("#weight_filter_from").datepicker({ dateFormat: "yy-mm-dd",
- minDate: {{min_date}}
- });
- $("#weight_filter_to").datepicker({ dateFormat: "yy-mm-dd",
- maxDate: {{max_date}}
- });
- // Process the filter
- $("#weight_diagram_refresh").click(function(e) {
+ $.getJSON("/weight/api/get_weight_data/", filter_data, function(json) {
+ weight_chart(json);
+ });
- e.preventDefault();
+ // Add datepickers to the filter elements
- var date_min = $("#weight_filter_from").val();
- var date_max = $("#weight_filter_to").val();
-
- $.getJSON("/weight/api/get_weight_data/",
- {'date_min': date_min,
- 'date_max': date_max},
- function(json) {
- weight_chart(json);
- });
+ $("#weight_filter_from").datepicker({ dateFormat: "yy-mm-dd",
+ {% if min_date %}minDate: {{ min_date }}{% endif %}
+ });
+ $("#weight_filter_to").datepicker({ dateFormat: "yy-mm-dd",
+ {% if max_date %}maxDate: {{max_date}}{% endif %}
+ });
-
- });
+ // Process the filter
+ $("#weight_diagram_refresh").click(function(e) {
+
+ e.preventDefault();
+
+ var date_min = $("#weight_filter_from").val();
+ var date_max = $("#weight_filter_to").val();
+
+ $.getJSON("/weight/api/get_weight_data/",
+ {'date_min': date_min,
+ 'date_max': date_max},
+ function(json) {
+ weight_chart(json);
+ });
+
+
+ });
+ }
// Init the modal dialog
form_modal_dialog();