From 0f018358e2c69fe43f695c7f5b40116942321cc6 Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Thu, 31 Mar 2022 17:36:14 +0200
Subject: [PATCH] [ADD]Change label autorpod

---
 models/acc_operation.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/models/acc_operation.py b/models/acc_operation.py
index e4b63fe..cdeaa0b 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)",
-- 
GitLab