diff --git a/models/acc_operation.py b/models/acc_operation.py index e4b63fefabd70d1244f12110962483bbd9559cbc..cdeaa0b308984a669f47cfa660aaa1c31c7b4f35 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -217,6 +217,11 @@ class AccOperation(models.Model): step_display_courbe = "month" if not scale: scale = "month" + elif delta > 365: + step = "year" + step_display_courbe = "year" + if not scale: + scale = "month" else: step = "month" step_display_courbe = "month" @@ -895,7 +900,7 @@ class AccOperation(models.Model): "labels": chart_data["label"], "datasets": [ { - "label": "AutoProd", + "label": "AutoConso", "data": chart_data["autocons_prod"], "backgroundColor": "rgba(91, 154, 81, 0.4)", "borderColor": "rgba(91, 154, 81, 1)", @@ -974,10 +979,10 @@ class AccOperation(models.Model): label = ["Surplus"] res = [int(sum_res2)] elif sum_res2 == 0: - label = ["AutoProd"] + label = ["AutoConso"] res = [int(sum_res1)] else: - label = ["AutoProd", "Surplus"] + label = ["AutoConso", "Surplus"] res = [int(sum_res1), int(sum_res2)] result["donuts_chart_prod"] = { @@ -1042,7 +1047,7 @@ class AccOperation(models.Model): "labels": data_label, "datasets": [ { - "label": "AutoProd", + "label": "AutoConso", "data": data_autocons, "backgroundColor": "rgba(91, 154, 81, 0.4)", "hoverBackgroundColor": "rgba(91, 154, 81, 0.7)",